Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,23 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from processing import process_file
|
| 3 |
-
from models import ModifiedGCN
|
| 4 |
|
| 5 |
def process_file_wrapper(file):
|
| 6 |
status, file = process_file(file)
|
| 7 |
return status, file
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
""")
|
| 15 |
-
file_input = gr.File(label="Upload your file")
|
| 16 |
-
status_output = gr.Textbox(label="Status")
|
| 17 |
-
file_output = gr.File(label="Download the file")
|
| 18 |
-
process_button = gr.Button("Process")
|
| 19 |
-
process_button.click(process_file_wrapper, inputs=file_input, outputs=[status_output, file_output])
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from processing import process_file
|
| 3 |
+
from models import ModifiedGCN
|
| 4 |
|
| 5 |
def process_file_wrapper(file):
|
| 6 |
status, file = process_file(file)
|
| 7 |
return status, file
|
| 8 |
|
| 9 |
+
def upload_file(file):
|
| 10 |
+
if file is None:
|
| 11 |
+
return "No file uploaded.", None
|
| 12 |
+
status, processed_file = process_file_wrapper(file)
|
| 13 |
+
return status, processed_file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# Create a Gradio Interface
|
| 16 |
+
iface = gr.Interface(
|
| 17 |
+
fn=upload_file,
|
| 18 |
+
inputs=gr.File(label="Upload your file"),
|
| 19 |
+
outputs=[gr.Textbox(label="Status"), gr.File(label="Download the file")]
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
# Launch the Gradio Interface
|
| 23 |
+
iface.launch(share=True)
|