File size: 715 Bytes
3184fc6
 
 
96c806c
91134f0
 
96c806c
3184fc6
 
 
 
96c806c
 
 
 
 
 
 
3184fc6
91134f0
 
 
3184fc6
91134f0
 
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
import streamlit as st
import os
import matplotlib.pyplot as plt
import requests
import pandas as pd


st.set_page_config(
    page_title='DataBoard' ,
    page_icon= plt.imread(os.path.abspath('static/logo.png')),
)
st.header('Deploy Streamlit project to HuggingFace spaces!')
st.write("Let's make a request to [dummy API](https://jsonplaceholder.typicode.com/users) and display the results")
url = "https://dummyjson.com/quotes"
@st.cache
def get_json_response(url:str) :
    response = requests.get(url)
    return response.json()

st.subheader('Json')
st.json(get_json_response(url), expanded=False)
"----"

st.subheader('DataFrame')
st.dataframe(pd.DataFrame.from_dict(dict(get_json_response(url))['quotes']))