gsasikiran commited on
Commit
c6c381f
·
1 Parent(s): 3d08384

Process output string

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -2,12 +2,17 @@ from transformers import pipeline
2
  import gradio as gr
3
 
4
  model = pipeline("summarization", model="gsasikiran/bart-base-finetuned-cnn", tokenizer="facebook/bart-base")
5
- title = "Article Title Generator"
6
- description = "Generates titles for articles based on the input text."
7
- article = "The quick brown fox jumps over the lazy dog."
 
 
 
 
 
8
 
9
  hf = gr.Interface(
10
- fn=model,
11
  inputs=gr.Textbox(lines=5, label="Input Text"),
12
  title=title,
13
  description=description,
 
2
  import gradio as gr
3
 
4
  model = pipeline("summarization", model="gsasikiran/bart-base-finetuned-cnn", tokenizer="facebook/bart-base")
5
+ title = "Article summarizer"
6
+ description = "Generate summaries for articles based on the input text."
7
+ article = ""
8
+
9
+ def generate_summary(text):
10
+ summary_text = model(text)[0]['summary_text']
11
+ summary_text = summary_text.replace("\n", " ")
12
+ return
13
 
14
  hf = gr.Interface(
15
+ fn=generate_summary,
16
  inputs=gr.Textbox(lines=5, label="Input Text"),
17
  title=title,
18
  description=description,