genelify commited on
Commit
475ee6f
·
verified ·
1 Parent(s): feb80ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -7,6 +7,8 @@ tokenizer = BartTokenizer.from_pretrained(model_name)
7
  model = BartForConditionalGeneration.from_pretrained(model_name)
8
 
9
  def summarize(input_text):
 
 
10
  inp = tokenizer.encode("summarize: " + input_text.replace('\n',''), return_tensors="pt", max_length=1024, truncation=True)
11
  summary_ids = model.generate(inp, num_beams=4, max_length=150, early_stopping=True)
12
  summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
@@ -19,4 +21,4 @@ app = gr.Interface(
19
  css="footer {visibility: hidden}",
20
  article = """<p style='text-align: center;'>Hello, thanks for coming, visit AI tools: <a href="https://www.genelify.com" target="_blank">Genelify</a>, visit Social Media tools: <a href="https://www.tubtic.com" target="_blank">Tubtic</a></p>"""
21
  )
22
- app.launch(inline=False, show_api=False)
 
7
  model = BartForConditionalGeneration.from_pretrained(model_name)
8
 
9
  def summarize(input_text):
10
+ if not input_text:
11
+ return ''
12
  inp = tokenizer.encode("summarize: " + input_text.replace('\n',''), return_tensors="pt", max_length=1024, truncation=True)
13
  summary_ids = model.generate(inp, num_beams=4, max_length=150, early_stopping=True)
14
  summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
 
21
  css="footer {visibility: hidden}",
22
  article = """<p style='text-align: center;'>Hello, thanks for coming, visit AI tools: <a href="https://www.genelify.com" target="_blank">Genelify</a>, visit Social Media tools: <a href="https://www.tubtic.com" target="_blank">Tubtic</a></p>"""
23
  )
24
+ app.launch(inline=False)