Spaces:
Sleeping
Sleeping
Commit
·
1730f75
1
Parent(s):
f67c950
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import requests
|
3 |
import json
|
|
|
4 |
|
5 |
# Function to fetch data from Google Knowledge Graph
|
6 |
def fetch_data(query, api_key):
|
@@ -29,6 +30,11 @@ if st.button('Search'):
|
|
29 |
st.subheader(f"Name: {item['name']}")
|
30 |
st.write(f"Description: {item.get('description', 'N/A')}")
|
31 |
st.write(f"Detail: {item.get('detailedDescription', {}).get('articleBody', 'N/A')}")
|
|
|
|
|
|
|
|
|
|
|
32 |
except:
|
33 |
st.write('No results found.')
|
34 |
else:
|
|
|
1 |
import streamlit as st
|
2 |
import requests
|
3 |
import json
|
4 |
+
import pprint
|
5 |
|
6 |
# Function to fetch data from Google Knowledge Graph
|
7 |
def fetch_data(query, api_key):
|
|
|
30 |
st.subheader(f"Name: {item['name']}")
|
31 |
st.write(f"Description: {item.get('description', 'N/A')}")
|
32 |
st.write(f"Detail: {item.get('detailedDescription', {}).get('articleBody', 'N/A')}")
|
33 |
+
st.write(f"URL: {item.get('url', 'N/A')}")
|
34 |
+
|
35 |
+
# Pretty-print the entire JSON response to display all outputs
|
36 |
+
st.subheader("Full JSON Response")
|
37 |
+
st.write(pprint.pformat(result))
|
38 |
except:
|
39 |
st.write('No results found.')
|
40 |
else:
|