-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (28 loc) · 901 Bytes
/
main.py
File metadata and controls
36 lines (28 loc) · 901 Bytes
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
27
28
29
30
31
32
33
34
35
36
import os.path
import subprocess
import sys
s = """
import pygwalker as pyg
from streamlit.components import v1 as components
import streamlit as st
import pandas as pd
# Adjust the width of the Streamlit page
st.set_page_config(
page_title="a simple data analyzer",
layout="wide"
)
# Add Title
st.title("a simple data analyzer")
uploaded_file = st.file_uploader("Choose a .csv")
if uploaded_file is not None:
# Can be used wherever a "file-like" object is accepted:
df = pd.read_csv(uploaded_file, encoding='utf-8')
# Generate the HTML using Pygwalker
pyg_html = pyg.walk(df, return_html=True)
# Embed the HTML into the Streamlit app
components.html(pyg_html, height=1000, scrolling=True)
"""
lit_py_path = os.path.join(sys._MEIPASS, 'lit.py')
with open(lit_py_path, 'wb') as f:
f.write(s.encode('utf-8'))
subprocess.run(['streamlit', 'run', lit_py_path])