ombhojane commited on
Commit
65dac95
1 Parent(s): 69093c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import json
4
+
5
+ # Title of the app
6
+ st.title('Gen AI Jam JSON Visualizer')
7
+
8
+ # File uploader widget
9
+ uploaded_file = st.file_uploader("Choose a JSON file", type=['json'])
10
+ if uploaded_file is not None:
11
+ # Reading the file
12
+ file_data = json.load(uploaded_file)
13
+
14
+ # If the JSON is deeply nested, you may need to normalize it to create a flat table
15
+ if isinstance(file_data, list): # Assuming the JSON is an array of records
16
+ df = pd.json_normalize(file_data)
17
+ else:
18
+ df = pd.json_normalize(file_data, max_level=1)
19
+
20
+ # Display the dataframe as a table
21
+ st.write(df)