reab5555 commited on
Commit
466cd11
·
verified ·
1 Parent(s): 0dfd8b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -5
app.py CHANGED
@@ -15,23 +15,38 @@ def create_interface():
15
  status_text = gr.Textbox(label="Status")
16
  execution_time = gr.Textbox(label="Execution Time", visible=False)
17
  detected_language = gr.Textbox(label="Detected Language", visible=False)
18
- input_info = gr.Textbox(label="Input Information", visible=False)
19
 
 
 
 
 
 
 
20
  chart_container = gr.Column()
21
 
22
  def process_and_update(input_file):
 
23
  results = process_input(input_file, progress=gr.Progress())
 
 
24
  chart_outputs = update_visibility_and_charts(*results)
25
- new_charts = [gr.Plot(visible=True) for _ in range(len(chart_outputs) - 4)]
26
- return chart_outputs[:4] + [gr.Column(new_charts)]
 
 
 
 
27
 
28
  input_file.upload(
29
  fn=process_and_update,
30
  inputs=[input_file],
31
- outputs=[status_text, execution_time, detected_language, input_info, chart_container]
32
  )
33
 
34
  return iface
35
 
36
  iface = create_interface()
37
- iface.launch()
 
 
 
 
15
  status_text = gr.Textbox(label="Status")
16
  execution_time = gr.Textbox(label="Execution Time", visible=False)
17
  detected_language = gr.Textbox(label="Detected Language", visible=False)
 
18
 
19
+ # Hidden textboxes for storing model outputs
20
+ attachments_output = gr.Textbox(visible=False)
21
+ bigfive_output = gr.Textbox(visible=False)
22
+ personalities_output = gr.Textbox(visible=False)
23
+
24
+ # Container for dynamically created charts
25
  chart_container = gr.Column()
26
 
27
  def process_and_update(input_file):
28
+ # Process the input
29
  results = process_input(input_file, progress=gr.Progress())
30
+
31
+ # Create and update charts
32
  chart_outputs = update_visibility_and_charts(*results)
33
+
34
+ # Create new chart components based on the number of charts
35
+ new_charts = [gr.Plot(visible=True) for _ in range(len(chart_outputs) - 3)] # -3 for the non-chart outputs
36
+
37
+ # Update the chart container
38
+ return chart_outputs[:3] + [gr.Column(new_charts)]
39
 
40
  input_file.upload(
41
  fn=process_and_update,
42
  inputs=[input_file],
43
+ outputs=[status_text, execution_time, detected_language, chart_container]
44
  )
45
 
46
  return iface
47
 
48
  iface = create_interface()
49
+
50
+ # Launch the app
51
+ if __name__ == "__main__":
52
+ iface.launch()