Oumnia commited on
Commit
e6665e0
1 Parent(s): 8de69c0

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+
5
+
6
+
7
+ text_summary = pipeline("summarization", model= "sshleifer/distilbart-xsum-12-6" )
8
+
9
+ def summarise_txt(input):
10
+ output = text_summary(input)
11
+ return output[0]['summary_text']
12
+
13
+ gr.close_all()
14
+ demo = gr.Interface(
15
+ fn= summarise_txt,
16
+ inputs= [gr.Textbox(label="input a text to summarize in here", lines=8)],
17
+ outputs= [gr.Textbox(label= "text after summarization", lines= 4)],
18
+ title= "text summarizer project",
19
+ description= "the project takes a text as input and a summarized text as an output using hugging face models"
20
+
21
+ )
22
+ demo.launch()
23
+
24
+
25
+
26
+