Spaces:
Sleeping
Sleeping
Download app.py from duvdar/SpaceTest1: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/duvdar/SpaceTest1/resolve/main/app.py
- Command line
-
hf download hf://spaces/duvdar/SpaceTest1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/duvdar/SpaceTest1/resolve/main/app.py
1.08 kB
| import streamlit as st | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| st.title('P2024-074606-14875 - Sistema de Clasificación de granos de Café Verde ') | |
| x = st.slider('Select a value') | |
| st.write(x, 'squared is', x * x) | |
| # Step 1: Upload CSV file | |
| uploaded_file = st.file_uploader('Choose a CSV file', type='csv') | |
| if uploaded_file is not None: | |
| # Step 2: Read the uploaded CSV file | |
| df = pd.read_csv(uploaded_file) | |
| st.write('Data Preview:') | |
| st.dataframe(df.head()) | |
| # Step 3: Select columns for x and y axes | |
| columns = df.columns.tolist() | |
| x_axis = st.selectbox('Select X-axis column', columns) | |
| y_axis = st.selectbox('Select Y-axis column', columns) | |
| # Step 4: Plot the selected data | |
| if x_axis and y_axis: | |
| st.write(f'Plotting {x_axis} vs {y_axis}') | |
| fig, ax = plt.subplots() | |
| ax.plot(df[x_axis], df[y_axis], marker='o') | |
| ax.set_xlabel(x_axis) | |
| ax.set_ylabel(y_axis) | |
| ax.set_title(f'{y_axis} vs {x_axis}') | |
| st.pyplot(fig) | |
| else: | |
| st.write('Please upload a CSV file to proceed.') | |