Spaces:
Runtime error
Runtime error
Edward J. Schwartz
commited on
Commit
·
c485ef9
1
Parent(s):
2c26c26
Fix some problems
Browse files
app.py
CHANGED
|
@@ -73,6 +73,10 @@ with gr.Blocks() as demo:
|
|
| 73 |
|
| 74 |
file_widget = gr.File(label="Binary file")
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
def file_change_fn(file):
|
| 77 |
|
| 78 |
if file is None:
|
|
@@ -80,15 +84,14 @@ with gr.Blocks() as demo:
|
|
| 80 |
all_dis_state: None}
|
| 81 |
else:
|
| 82 |
|
|
|
|
| 83 |
fun_data = get_all_dis(file.name)
|
| 84 |
|
| 85 |
return {col: gr.update(visible=True),
|
| 86 |
-
fun_dropdown: gr.update(choices=fun_data.keys()),
|
| 87 |
-
all_dis_state: fun_data
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
#output = gr.Textbox("Output")
|
| 91 |
-
fun_dropdown = gr.Dropdown(label="Functions", choices=[""])
|
| 92 |
|
| 93 |
file_widget.change(file_change_fn, file_widget, [col, fun_dropdown, all_dis_state])
|
| 94 |
|
|
|
|
| 73 |
|
| 74 |
file_widget = gr.File(label="Binary file")
|
| 75 |
|
| 76 |
+
with gr.Column(visible=False) as col:
|
| 77 |
+
#output = gr.Textbox("Output")
|
| 78 |
+
fun_dropdown = gr.Dropdown(label="Select a function", choices=["Woohoo!"], interactive=True)
|
| 79 |
+
|
| 80 |
def file_change_fn(file):
|
| 81 |
|
| 82 |
if file is None:
|
|
|
|
| 84 |
all_dis_state: None}
|
| 85 |
else:
|
| 86 |
|
| 87 |
+
#fun_data = {'one': 2, 'two': 3}
|
| 88 |
fun_data = get_all_dis(file.name)
|
| 89 |
|
| 90 |
return {col: gr.update(visible=True),
|
| 91 |
+
fun_dropdown: gr.Dropdown.update(choices=list(fun_data.keys()), value=next(iter(fun_data.keys()))),
|
| 92 |
+
all_dis_state: fun_data
|
| 93 |
+
}
|
| 94 |
+
|
|
|
|
|
|
|
| 95 |
|
| 96 |
file_widget.change(file_change_fn, file_widget, [col, fun_dropdown, all_dis_state])
|
| 97 |
|