File size: 541 Bytes
45659e5
 
 
8bfeedd
 
45659e5
 
 
 
 
 
 
 
 
 
751287e
 
45659e5
 
 
8bfeedd
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

# Initialize the summarization pipeline with a specified model
pipe = pipeline("summarization", model="t5-small")

# Define a function for the summarization
def summarize(text):
    return pipe(text)[0]['summary_text']

# Create a Gradio interface
interface = gr.Interface(
    fn=summarize,
    inputs="text",
    outputs="text",
    title="Summarize Lengthy Texts - M Fahad Bashir ",
    description="Enter text to t a summary."
)

# Launch the interface
interface.launch(share=True)