derina commited on
Commit
2a1640e
1 Parent(s): 3387cd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -3,12 +3,20 @@ from transformers import pipeline
3
 
4
  summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
5
 
 
6
  def summarize(text):
7
- return summarizer(text, max_length=400, min_length=50)[0]['summary_text']
8
-
9
-
10
  title = "OpenAI Summarizer"
11
  description = "Abstractive Text Summarization using Hugging Face transformers."
12
  article = "<div style='text-align: center; max-width:800px; margin:10px auto;'><p></p><p>Sources: <a href='https://github.com/huggingface/transformers/' target='_blank'>Transformers</a>: Machine Learning with pretrained models</p><p style='text-align: center'> With help of <a href='https://fxstrengthmeter.com/' target='_blank'>Currency Strength meter</a>: live indicator with real-time market data that compares a currency with other major currencies</p></div>"
13
-
14
- gr.Interface(fn=summarize, inputs=gr.inputs.Textbox(lines=12, placeholder="Enter text to summarize here"), outputs="text", title=title, description=description, article=article).launch()
 
 
 
 
 
 
 
 
3
 
4
  summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
5
 
6
+
7
  def summarize(text):
8
+ return summarizer(text, max_length=400, min_length=50)[0]["summary_text"]
9
+
10
+
11
  title = "OpenAI Summarizer"
12
  description = "Abstractive Text Summarization using Hugging Face transformers."
13
  article = "<div style='text-align: center; max-width:800px; margin:10px auto;'><p></p><p>Sources: <a href='https://github.com/huggingface/transformers/' target='_blank'>Transformers</a>: Machine Learning with pretrained models</p><p style='text-align: center'> With help of <a href='https://fxstrengthmeter.com/' target='_blank'>Currency Strength meter</a>: live indicator with real-time market data that compares a currency with other major currencies</p></div>"
14
+
15
+ gr.Interface(
16
+ fn=summarize,
17
+ inputs=gr.inputs.Textbox(lines=12, placeholder="Enter text to summarize here"),
18
+ outputs="text",
19
+ title=title,
20
+ description=description,
21
+ article=article,
22
+ ).launch()