Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from processing import process_input
|
3 |
from visualization import update_visibility_and_charts
|
|
|
4 |
|
5 |
def create_interface():
|
6 |
with gr.Blocks() as iface:
|
@@ -28,7 +29,14 @@ def create_interface():
|
|
28 |
results = process_input(input_file, progress=gr.Progress())
|
29 |
|
30 |
# Create and update charts and explanations
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
input_file.upload(
|
34 |
fn=process_and_update,
|
@@ -42,4 +50,4 @@ iface = create_interface()
|
|
42 |
|
43 |
# Launch the app
|
44 |
if __name__ == "__main__":
|
45 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from processing import process_input
|
3 |
from visualization import update_visibility_and_charts
|
4 |
+
import json
|
5 |
|
6 |
def create_interface():
|
7 |
with gr.Blocks() as iface:
|
|
|
29 |
results = process_input(input_file, progress=gr.Progress())
|
30 |
|
31 |
# Create and update charts and explanations
|
32 |
+
outputs = update_visibility_and_charts(*results)
|
33 |
+
|
34 |
+
# Convert JSON-encoded Plotly figures back to Plotly objects
|
35 |
+
for i, output in enumerate(outputs):
|
36 |
+
if isinstance(output, str) and output.startswith('{"data":'):
|
37 |
+
outputs[i] = json.loads(output)
|
38 |
+
|
39 |
+
return outputs
|
40 |
|
41 |
input_file.upload(
|
42 |
fn=process_and_update,
|
|
|
50 |
|
51 |
# Launch the app
|
52 |
if __name__ == "__main__":
|
53 |
+
iface.launch()
|