File size: 606 Bytes
ed2da69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import streamlit as st
import os
import matplotlib.pyplot as plt
import requests
import pandas as pd

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_data
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']))