bluenevus commited on
Commit
ebf86ea
·
verified ·
1 Parent(s): 7f2fb01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -139,7 +139,24 @@ def data_analysis_dashboard():
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')
145
  instructions = input.inputs.get('instructions')
@@ -156,7 +173,7 @@ def generate_insights():
156
  img_str = base64.b64encode(buffered.getvalue()).decode()
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
 
 
139
  with use_scope('output'):
140
  for i in range(3):
141
  put_scope(f'visualization_{i+1}')
142
+
143
+ def data_analysis_dashboard():
144
+ set_env(title="Data Analysis Dashboard")
145
+ put_text("# Data Analysis Dashboard")
146
+
147
+ with use_scope('form'):
148
+ put_row([
149
+ put_column([
150
+ put_file_upload("Upload Dataset", accept=[".csv", ".xlsx"], name="file"),
151
+ put_input("Analysis Instructions", type="text", placeholder="Describe the analysis you want...", name="instructions"),
152
+ put_buttons(['Generate Insights'], onclick=[lambda: generate_insights()])
153
+ ])
154
+ ])
155
+
156
+ with use_scope('output'):
157
+ for i in range(3):
158
+ put_scope(f'visualization_{i+1}')
159
+
160
  def generate_insights():
161
  file = file_upload.files.get('file')
162
  instructions = input.inputs.get('instructions')
 
173
  img_str = base64.b64encode(buffered.getvalue()).decode()
174
  with use_scope(f'visualization_{i+1}', clear=True):
175
  put_image(img_str, width='100%')
176
+
177
  def main():
178
  data_analysis_dashboard()
179