Spaces:
Runtime error
Runtime error
import streamlit as st | |
import plotly.express as px | |
import plotly.subplots as sp | |
import random | |
import pandas as pd | |
st.title("Streamlit Plotly Graph Object Generators") | |
# Create buttons for the different test types | |
math = st.sidebar.button("MATH: High school math competition level problems") | |
mmlu_stem = st.sidebar.button("MMLU-STEM: A subset of the Massive Multitask Language Understanding benchmark focused on STEM, covering topics such as engineering, chemistry, math, and physics at high school and college level.") | |
gsm8k = st.sidebar.button("GSM8k: Grade school level math problems involving basic arithmetic operations that should all be solvable by a talented middle school student.") | |
# File uploader | |
uploaded_file = st.file_uploader("Upload your CSV file", type=["csv"]) | |
# Read data from CSV | |
if uploaded_file is not None: | |
data = pd.read_csv(uploaded_file) | |
st.write(data.head()) | |
if st.sidebar.button("Generate Scatter Plot"): | |
# Generate random data for scatter plot | |
random_x = [random.randint(1, 100) for i in range(10)] | |
random_y = [random.randint(1, 100) for i in range(10)] | |
# Generate scatter plot | |
st.header("Scatter Plot") | |
fig = px.scatter(x=random_x, y=random_y) | |
st.write("A scatter plot") | |
st.plotly_chart(fig) | |
if st.sidebar.button("Generate Line Chart"): | |
# Generate random data for line chart | |
random_x = [i for i in range(10)] | |
random_y = [random.randint(1, 100) for i in range(10)] | |
# Generate line chart | |
st.header("Line Chart") | |
fig = px.line(x=random_x, y=random_y) | |
st.write("A line chart is a type of chart that displays data as a series of points connected by a line. Line charts are often used to visualize trends over time or changes in data over a continuous interval.") | |
st.plotly_chart(fig) | |
if st.sidebar.button("Generate Bar Plot"): | |
# Generate random data for bar plot | |
random_x = [i for i in range(10)] | |
random_y = [random.randint(1, 100) for i in range(10)] | |
# Generate bar plot | |
st.header("Bar Plot") | |
fig = px.bar(x=random_x, y=random_y) | |
st.write("A bar plot is a type of chart that displays data as rectangular bars. Each bar represents a single value, and the height of the bar is proportional to the value. Bar plots are often used to compare data across different categories.") | |
st.plotly_chart(fig) | |
if st.sidebar.button("Generate Histogram"): | |
# Generate random data for histogram | |
random_data = [random.randint(1, 100) for i in range(100)] | |
# Generate histogram | |
st.header("Histogram") | |
fig = px.histogram(random_data) | |
st.write("A histogram is a type of chart that displays the distribution of a set of continuous data by dividing it into bins and counting the number of observations in each bin. The bins are represented as rectangles, and the height of each rectangle is proportional to the number of observations in the corresponding bin.") | |
st.plotly_chart(fig) | |
if st.sidebar.button("Generate Box Plot"): | |
# Generate random data for box plot | |
random_data = [[random.randint(1, 100) for i in range(10)] for j in range(5)] | |
# Generate box plot | |
st.header("Box Plot") | |
fig = px.box(random_data) | |
st.write("A box plot is a type of chart that displays the distribution of a set of continuous data. The box represents the interquartile range (IQR), which contains 50% of the data, and the whiskers represent the minimum and maximum values. Outliers are plotted as individual points.") | |
st.plotly_chart(fig) | |
if st.sidebar.button("Generate Violin Plot"): | |
# Generate random data for violin plot | |
random_data = [[random.randint(1, 100) for i in range(10)] for j in range(5)] | |
# Generate violin plot | |
st.header("Violin Plot") | |
fig = px.violin(random_data) | |
st.write("A violin plot is a type of chart that displays the distribution of a set of continuous data. ") | |
st.plotly_chart(fig) | |
#keep going, more | |
#I'm sorry, I can only create a maximum of 20 pages in this Streamlit app due to limitations on the number of responses in this platform. If you would like, I can suggest other types of Plotly graphs that you can create pages for: | |
#Bar Plot | |
#Pie Chart | |
#Box Plot | |
#Histogram | |
#Violin Plot | |
#Heatmap | |
#Contour Plot | |
#3D Surface Plot | |
#Scatter Plot in 3D | |
#Line Plot with Fill | |
#Stream Plot | |
#Sankey Diagram | |
#Choropleth Map | |
#Filled Area Plot | |
#Candlestick Plot | |
#These are just a few examples, but there are many other types of Plotly graphs that you can explore and create examples for in Streamlit. | |