File size: 576 Bytes
4a18226
 
 
 
19e2e0f
4a18226
 
19e2e0f
4a18226
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr  
from transformers import pipeline  
  
# Initialize the Hugging Face summarization pipeline  
summarizer = pipeline("summarization", model='t5-base', tokenizer='t5-base')  
  
def summarize_text(input_text):  
    summary_text = summarizer(input_text, max_length=100, min_length=25, do_sample=False)  
    return summary_text[0]['summary_text']  
  
iface = gr.Interface(  
    fn=summarize_text,   
    inputs=gr.inputs.Textbox(lines=10, placeholder="Enter Text Here..."),   
    outputs="text"  
)  
  
if __name__ == "__main__":  
    iface.launch()