File size: 654 Bytes
82352fb
 
 
 
 
 
c1f91ca
8da1870
c1f91ca
82352fb
 
 
c1f91ca
 
82352fb
c1f91ca
 
82352fb
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import pipeline

# Load the text summarization pipeline from Hugging Face Transformers
summarizer = pipeline("summarization")

def summarize_text(input_text):
    summary = summarizer(input_text, max_length=150, min_length=30, do_sample=False)[0]['summary_text']
    return summary

# Interface for the Gradio app
iface = gr.Interface(
    fn=summarize_text,
    inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
    outputs=gr.outputs.Textbox(label="Summary"),
    title="Text Summarizer",
    description="Enter a piece of text, and the app will provide a summary.",
)

# Launch the Gradio app
iface.launch()