ayushhh05 commited on
Commit
5c30c33
·
verified ·
1 Parent(s): 9777ab4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load your fine-tuned model from Hugging Face
5
+ summarizer = pipeline("summarization", model="ayushhh05/t5-summarization")
6
+
7
+ # Function to summarize text
8
+ def summarize_text(input_text):
9
+ summary = summarizer(input_text, max_length=100, min_length=30, do_sample=False)
10
+ return summary[0]["summary_text"]
11
+
12
+ # Create Gradio interface
13
+ iface = gr.Interface(
14
+ fn=summarize_text,
15
+ inputs=gr.Textbox(lines=5, placeholder="Enter text to summarize..."),
16
+ outputs="text",
17
+ title="AI Summarizer",
18
+ description="Enter any text, and the AI will summarize it.",
19
+ )
20
+
21
+ # Launch the Gradio app
22
+ iface.launch()