| import gradio as gr | |
| from processing import process_file | |
| def process_file_wrapper(file): | |
| status, file = process_file(file) | |
| return status, file | |
| with gr.Blocks() as demo: | |
| gr.Markdown( | |
| """ | |
| # File Processor | |
| Upload a file and click 'Process' to see the status and download the file. | |
| """) | |
| file_input = gr.File(label="Upload your file") | |
| status_output = gr.Textbox(label="Status") | |
| file_output = gr.File(label="Download the file") | |
| process_button = gr.Button("Process") | |
| process_button.click(process_file_wrapper, inputs=file_input, outputs=[status_output, file_output]) | |
| if __name__ == "__main__": | |
| demo.launch() | |