Spaces:
Sleeping
Sleeping
File size: 1,680 Bytes
9bad7f1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
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]
)
demo.launch()
|