Update app.py
Browse files
app.py
CHANGED
@@ -8,8 +8,8 @@ import traceback
|
|
8 |
import os
|
9 |
from pywebio import start_server
|
10 |
from pywebio.input import file_upload, input
|
11 |
-
from pywebio.output import put_text, put_image, put_row, put_column, use_scope, put_buttons
|
12 |
-
from pywebio.session import run_js
|
13 |
import base64
|
14 |
import threading
|
15 |
|
@@ -124,6 +124,7 @@ def process_file(file, instructions):
|
|
124 |
return [error_image] * 3
|
125 |
|
126 |
def data_analysis_dashboard():
|
|
|
127 |
put_text("# Data Analysis Dashboard")
|
128 |
|
129 |
with use_scope('form'):
|
@@ -137,7 +138,7 @@ def data_analysis_dashboard():
|
|
137 |
|
138 |
with use_scope('output'):
|
139 |
for i in range(3):
|
140 |
-
|
141 |
|
142 |
def generate_insights():
|
143 |
file = file_upload.files.get('file')
|
@@ -156,22 +157,6 @@ def generate_insights():
|
|
156 |
with use_scope(f'visualization_{i+1}', clear=True):
|
157 |
put_image(img_str, width='100%')
|
158 |
|
159 |
-
def data_analysis_dashboard():
|
160 |
-
put_text("# Data Analysis Dashboard")
|
161 |
-
|
162 |
-
with use_scope('form'):
|
163 |
-
put_row([
|
164 |
-
put_column([
|
165 |
-
put_text(file_upload("Upload Dataset", accept=[".csv", ".xlsx"], name="file")),
|
166 |
-
put_text(input("Analysis Instructions", type="text", placeholder="Describe the analysis you want...", name="instructions")),
|
167 |
-
put_buttons(['Generate Insights'], onclick=[lambda: generate_insights()])
|
168 |
-
])
|
169 |
-
])
|
170 |
-
|
171 |
-
with use_scope('output'):
|
172 |
-
for i in range(3):
|
173 |
-
put_image(name=f'visualization_{i+1}')
|
174 |
-
|
175 |
def main():
|
176 |
data_analysis_dashboard()
|
177 |
|
|
|
8 |
import os
|
9 |
from pywebio import start_server
|
10 |
from pywebio.input import file_upload, input
|
11 |
+
from pywebio.output import put_text, put_image, put_row, put_column, use_scope, put_buttons, put_scope
|
12 |
+
from pywebio.session import run_js, set_env
|
13 |
import base64
|
14 |
import threading
|
15 |
|
|
|
124 |
return [error_image] * 3
|
125 |
|
126 |
def data_analysis_dashboard():
|
127 |
+
set_env(title="Data Analysis Dashboard")
|
128 |
put_text("# Data Analysis Dashboard")
|
129 |
|
130 |
with use_scope('form'):
|
|
|
138 |
|
139 |
with use_scope('output'):
|
140 |
for i in range(3):
|
141 |
+
put_scope(f'visualization_{i+1}')
|
142 |
|
143 |
def generate_insights():
|
144 |
file = file_upload.files.get('file')
|
|
|
157 |
with use_scope(f'visualization_{i+1}', clear=True):
|
158 |
put_image(img_str, width='100%')
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
def main():
|
161 |
data_analysis_dashboard()
|
162 |
|