Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| # text_summary = pipeline( | |
| # "text-generation", | |
| # model="sshleifer/distilbart-cnn-12-6" | |
| # ) | |
| # text_summary = pipeline( | |
| # "summarization", | |
| # model="sshleifer/distilbart-cnn-12-6" | |
| # ) | |
| text_summary = pipeline(task="any-to-any", model="google/pegasus-billsum") | |
| def summary(input_text): | |
| output = text_summary(input_text, max_length=100, min_length=30, do_sample=False) | |
| print(f"output: {output}") | |
| return output[0]["summary_text"] | |
| demo = gr.Interface( | |
| fn=summary, | |
| inputs=gr.Textbox(label="Input text to summarize", lines=6), | |
| outputs=gr.Textbox(label="Summarized Text", lines=4), | |
| title="My Gen AI Practice Project 1: TEXT SUMMARIZER", | |
| description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT" | |
| ) | |
| demo.launch() |