Spaces:
Running
Running
going back to gradio on HF
Browse files
app.py
CHANGED
@@ -1,23 +1,16 @@
|
|
1 |
-
import
|
2 |
import pandas as pd
|
3 |
import numpy as np
|
|
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
|
|
9 |
|
10 |
-
|
11 |
-
import hopsworks
|
12 |
-
from functions import util
|
13 |
-
import os
|
14 |
-
|
15 |
-
if __name__ == "__main__":
|
16 |
-
if "df" not in st.session_state:
|
17 |
-
st.session_state.df = pd.DataFrame(np.random.randn(20, 2), columns=["x", "y"])
|
18 |
-
else:
|
19 |
-
st.session_state.df = pd.DataFrame(
|
20 |
-
np.random.randn(20, 3),
|
21 |
-
columns=['a', 'b', 'c'])
|
22 |
-
|
23 |
-
st.line_chart(st.session_state.df)
|
|
|
1 |
+
import gradio as gr
|
2 |
import pandas as pd
|
3 |
import numpy as np
|
4 |
+
import random
|
5 |
|
6 |
+
df = pd.DataFrame({
|
7 |
+
'height': np.random.randint(50, 70, 25),
|
8 |
+
'weight': np.random.randint(120, 320, 25),
|
9 |
+
'age': np.random.randint(18, 65, 25),
|
10 |
+
'ethnicity': [random.choice(["white", "black", "asian"]) for _ in range(25)]
|
11 |
+
})
|
12 |
|
13 |
+
with gr.Blocks() as demo:
|
14 |
+
gr.LinePlot(df, x="weight", y="height")
|
15 |
|
16 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app2.py
CHANGED
@@ -1,6 +1,23 @@
|
|
1 |
-
import
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
|
5 |
+
st.title('Lahore Air Quality!')
|
6 |
+
st.subheader('Particle matter, diameter < 2.5 micrometers (PM2.5)')
|
7 |
+
|
8 |
+
### Load data
|
9 |
+
|
10 |
+
import datetime
|
11 |
+
import hopsworks
|
12 |
+
from functions import util
|
13 |
+
import os
|
14 |
+
|
15 |
+
if __name__ == "__main__":
|
16 |
+
if "df" not in st.session_state:
|
17 |
+
st.session_state.df = pd.DataFrame(np.random.randn(20, 2), columns=["x", "y"])
|
18 |
+
else:
|
19 |
+
st.session_state.df = pd.DataFrame(
|
20 |
+
np.random.randn(20, 3),
|
21 |
+
columns=['a', 'b', 'c'])
|
22 |
+
|
23 |
+
st.line_chart(st.session_state.df)
|