Spaces:
Sleeping
Sleeping
import gradio as gr | |
from helper_fns import process_files, get_summarization_method | |
from summarizer import summarize_files | |
with gr.Blocks() as demo: | |
with gr.Row(): | |
with gr.Column(): | |
files = gr.UploadButton( | |
label='Upload Files For Summarization', | |
file_count='multiple', | |
file_types=["pdf", "docx", "pptx"] | |
) | |
summarization_method_radio = gr.Radio(choices=['map_reduce', 'stuff', 'refine'], | |
value='map_reduce', | |
label='Select Summarization Method', | |
interactive=False) | |
generate_summaries_button = gr.Button(value='Generate Summaries', | |
interactive=False, | |
elem_id='summary_button') | |
files.upload(process_files, None, outputs=[generate_summaries_button, | |
summarization_method_radio]) | |
summarization_method_radio.input(fn = get_summarization_method, | |
inputs=summarization_method_radio) | |
with gr.Column(): | |
summary_text = gr.Textbox(label='Summarized Text: ', | |
interactive=False) | |
generate_summaries_button.click( | |
fn = summarize_files, | |
inputs=[summarization_method_radio, files], | |
outputs=[summary_text]#, audio_file] | |
) | |