prateek-genAi commited on
Commit
b44a0f4
·
verified ·
1 Parent(s): 9aaeb1b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+
4
+ # Use a pipeline as a high-level helper
5
+ from transformers import pipeline
6
+ pipe = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
7
+
8
+ def summarize(input):
9
+ output = pipe(input)
10
+ return output[0]['summary_text'] # Assuming 'summary_text' is the correct key
11
+
12
+ demo = gr.Interface(
13
+ fn=summarize,
14
+ inputs=gr.Textbox(lines=10, placeholder="Paste your text here...", label="Input Text"),
15
+ outputs=gr.Textbox(label="Summarized Output"),
16
+ title=" prateek-genAI Text Summarizer",
17
+ description="Enter a paragraph or article and get a concise summary using a text summarization model.",
18
+ theme="default", # You can try "compact" or "huggingface"
19
+ examples=[
20
+ ["The internet has transformed how we access information. With just a few clicks..."],
21
+ ["Artificial Intelligence is a growing field in computer science that..."]
22
+ ],
23
+ allow_flagging="never"
24
+ )
25
+
26
+ demo.launch()
27
+