Spaces:
Runtime error
Runtime error
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" | |
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'])) | |