Spaces:
Build error
Build error
File size: 3,759 Bytes
b43db09 cb57b83 b43db09 d48ee89 d12cccf 7b1bf09 a30f14c 08c74e3 a30f14c 08c74e3 4adc403 c49b1ad 62d39b5 1eb7ba6 c843d46 560306f c843d46 560306f c843d46 560306f c843d46 560306f c843d46 560306f c843d46 560306f c843d46 560306f c72f30b 560306f 660841c b5abd0c 660841c b5abd0c 9f3d202 cb57b83 560306f cb57b83 560306f cb57b83 9f3d202 cb57b83 9f3d202 cb57b83 9f3d202 cb57b83 9f3d202 cb57b83 9f3d202 cb57b83 9f3d202 cb57b83 9f3d202 0ee79d1 560306f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | import streamlit as st
import plotly.express as px
st.title("Hello World!")
st.write("This is my first Streamlit app on Hugging Face Space")
name = st.text_input("Enter your name : ")
age = st.slider("Select your age : ", 0, 100, 25)
if st.button("Submit"):
st.write(f" Hello {name}, your are {age} years old!")
# Example 1 : Text Input and Button
st.title("Interactive App : User Input")
# Text Input Feild
name = st.text_input("Enter your name:")
# Create Button
if st.button("Greet"):
st.write(f"Hello, {name}! Welcome to your first interactive Streamlit app.")
# Example 2 : Dropdown Selection
st.title("Dropdown Selection Example")
# Dropdown menu
options = ("Python", "JavaScript", "Java", "C++")
chioce = st.selectbox("Choose a programming language :",options)
st.write(f"You selected: {chioce}!")
import streamlit as st
st.title("Multi-Select Example")
# Multi-select widget
hobbies = st.multiselect("Select your hobbies:", ["Reading", "Traveling", "Cooking", "Gaming"])
st.write(f"Your selected hobbies are: {', '.join(hobbies)}")
# CSV File Upload and Display
# import streamlit as st
# import pandas as pd
# # import matplotlib.pyplot as plt
# import plotly.express as px
# st.title("CSV File Upload and Display")
# # File uploader
# uploaded_file = st.file_uploader("Upload a CSV file", type=["csv"])
# if uploaded_file:
# # Read the uploaded file
# data = pd.read_csv(uploaded_file)
# # Display the data preview
# st.write("Data Preview:")
# st.dataframe(data)
# # Display data statistics
# if uploaded_file:
# st.write("Data Statistics:")
# st.write(data.describe())
# # Display a line and Bar chart
# if uploaded_file:
# st.write("Line Chart Example:")
# st.line_chart(data)
# st.write("Bar Chart Example:")
# st.bar_chart(data)
# st.write("Custom Matplotlib Chart")
# fig, ax = plt.subplots()
# ax.plot(data.iloc[:, 0], data.iloc[:, 1])
# ax.set_title("Custom Line Plot")
# st.pyplot(fig)
# User selects x and y axes
# x_axis = st.selectbox("Choose X-axis:", data.columns)
# y_axis = st.selectbox("Choose Y-axis:", data.columns)
# # Generate scatter plot
# fig = px.scatter(data, x=x_axis, y=y_axis, title="Scatter Plot")
# st.plotly_chart(fig)
# Plotly Example
# import streamlit as st
# import pandas as pd
# import plotly.express as px
# st.title("CSV File Upload and Display")
# # File uploader
# uploaded_file = st.file_uploader("Upload a CSV file", type=["csv"])
# if uploaded_file:
# data = pd.read_csv(uploaded_file)
# st.write("Just loaded Data:")
# st.dataframe(data)
# # User selects x and y axes
# x_axis = st.selectbox("Choose X-axis:", data.columns)
# y_axis = st.selectbox("Choose Y-axis:", data.columns)
# # Generate scatter plot
# fig = px.scatter(data, x=x_axis, y=y_axis, title="Scatter Plot")
# st.plotly_chart(fig)
import streamlit as st
import pandas as pd
import plotly.express as px
st.title("Dashboard Example")
# File uploader
uploaded_file = st.file_uploader("Upload CSV for Dashboard", type=["csv"])
if uploaded_file:
data = pd.read_csv(uploaded_file)
st.sidebar.title("Dashboard Controls")
# Sidebar controls
column = st.sidebar.selectbox("Select column to analyze:", data.columns)
chart_type = st.sidebar.selectbox("Choose chart type:", ["Bar", "Line", "Scatter"])
# Display summary
st.write("Summary Statistics:")
st.write(data.describe())
# Generate chart
if chart_type == "Bar":
st.bar_chart(data[column])
elif chart_type == "Line":
st.line_chart(data[column])
else:
fig = px.scatter(data, x=data.index, y=column)
st.plotly_chart(fig)
|