sajjadyazdanparast commited on
Commit
96c806c
1 Parent(s): 8dd6424

UPDATE app.py to display a simple json

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -1,21 +1,19 @@
1
  import streamlit as st
2
  import os
3
  import matplotlib.pyplot as plt
4
- from database_interface.utils import *
 
5
  st.set_page_config(
6
  page_title='DataBoard' ,
7
  page_icon= plt.imread(os.path.abspath('static/logo.png')),
8
  )
9
- st.session_state.dfs = os.listdir(os.path.abspath('database/dataframes'))
 
 
 
 
 
 
10
 
11
- def on_selectbox_change() :
12
- df = pd.read_csv(os.path.abspath('database/dataframes')+'\\'+st.session_state.df_name)
13
- st.dataframe(df)
14
 
15
- st.sidebar.title('DataFrames')
16
- with st.sidebar:
17
- st.selectbox(label='Which dataframe to display?',
18
- options=st.session_state.dfs,
19
- on_change=on_selectbox_change,
20
- key='df_name',
21
- )
 
1
  import streamlit as st
2
  import os
3
  import matplotlib.pyplot as plt
4
+ import requests
5
+
6
  st.set_page_config(
7
  page_title='DataBoard' ,
8
  page_icon= plt.imread(os.path.abspath('static/logo.png')),
9
  )
10
+ st.header('Deploy Streamlit project to HuggingFace spaces!')
11
+ st.write("Let's make a request to [dummy API](https://jsonplaceholder.typicode.com/users) and display the results")
12
+ url = "https://dummyjson.com/quotes"
13
+ @st.cache
14
+ def get_json_response(url:str) :
15
+ response = requests.get(url)
16
+ return response.json()
17
 
 
 
 
18
 
19
+ st.json(get_json_response(url), expanded=False)