File size: 638 Bytes
83ef2b4
b6c6054
83ef2b4
82d257c
069dc7a
83ef2b4
82d257c
 
 
 
76abc58
82d257c
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from transformers import pipeline

# Load the text summarization pipeline
summarizer = pipeline("summarization")

def summarize_text(input_text):
    # Use the summarization pipeline to generate a summary
    summary = summarizer(input_text, max_length=100, min_length=30, do_sample=False)
    return summary[0]['summary_text']

# Create the Gradio interface
iface = gr.Interface(fn=summarize_text, 
                     inputs="text", 
                     outputs="text", 
                     title="Text Summarization", 
                     description="Enter some text and get a summary of it.")

iface.launch()