Files changed (1) hide show
  1. app.py +1 -18
app.py CHANGED
@@ -1,26 +1,9 @@
1
  import torch
2
  import gradio as gr
3
-
4
- # Use a pipeline as a high-level helper
5
  from transformers import pipeline
6
 
7
  text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16)
8
 
9
- # model_path = ("../Models/models--sshleifer--distilbart-cnn-12-6/snapshots"
10
- # "/a4f8f3ea906ed274767e9906dbaede7531d660ff")
11
- # text_summary = pipeline("summarization", model=model_path,
12
- # torch_dtype=torch.bfloat16)
13
-
14
-
15
-
16
- # text='''Elon Reeve Musk (/ˈiːlɒn/ EE-lon; born June 28, 1971) is a businessman and investor.
17
- # He is the founder, chairman, CEO, and CTO of SpaceX; angel investor, CEO, product architect,
18
- # and former chairman of Tesla, Inc.; owner, executive chairman, and CTO of X Corp.;
19
- # founder of the Boring Company and xAI; co-founder of Neuralink and OpenAI; and president
20
- # of the Musk Foundation. He is one of the wealthiest people in the world; as of April 2024,
21
- # Forbes estimates his net worth to be $178 billion.[4]'''
22
- # print(text_summary(text));
23
-
24
  def summary (input):
25
  output = text_summary(input)
26
  return output[0]['summary_text']
@@ -31,7 +14,7 @@ gr.close_all()
31
  demo = gr.Interface(fn=summary,
32
  inputs=[gr.Textbox(label="Input text to summarize",lines=6)],
33
  outputs=[gr.Textbox(label="Summarized text",lines=4)],
34
- title="@GenAILearniverse Project 1: Text Summarizer",
35
  description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT")
36
  demo.launch()
37
 
 
1
  import torch
2
  import gradio as gr
 
 
3
  from transformers import pipeline
4
 
5
  text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16)
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  def summary (input):
8
  output = text_summary(input)
9
  return output[0]['summary_text']
 
14
  demo = gr.Interface(fn=summary,
15
  inputs=[gr.Textbox(label="Input text to summarize",lines=6)],
16
  outputs=[gr.Textbox(label="Summarized text",lines=4)],
17
+ title="Text Summarizer",
18
  description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT")
19
  demo.launch()
20