gsmayuresh commited on
Commit
2a558cf
·
verified ·
1 Parent(s): 17dee13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -19
app.py CHANGED
@@ -4,27 +4,9 @@ import gradio as gr
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
- text_summary = pipeline(
9
- "text2text-generation",
10
- model="sshleifer/distilbart-cnn-12-6",
11
- torch_dtype=torch.float32, # safer on CPU
12
- )
13
- # model_path = ("../Models/models--sshleifer--distilbart-cnn-12-6/snapshots"
14
- # "/a4f8f3ea906ed274767e9906dbaede7531d660ff")
15
- # text_summary = pipeline("summarization", model=model_path,
16
- # torch_dtype=torch.bfloat16)
17
 
18
 
19
-
20
- # text='''Elon Reeve Musk (/ˈiːlɒn/ EE-lon; born June 28, 1971) is a businessman and investor.
21
- # He is the founder, chairman, CEO, and CTO of SpaceX; angel investor, CEO, product architect,
22
- # and former chairman of Tesla, Inc.; owner, executive chairman, and CTO of X Corp.;
23
- # founder of the Boring Company and xAI; co-founder of Neuralink and OpenAI; and president
24
- # of the Musk Foundation. He is one of the wealthiest people in the world; as of April 2024,
25
- # Forbes estimates his net worth to be $178 billion.[4]'''
26
- # print(text_summary(text));
27
-
28
  def summary(input_text):
29
  out = text_summary(input_text)
30
  return out[0]["generated_text"]
 
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
 
 
 
 
 
 
 
 
 
 
10
  def summary(input_text):
11
  out = text_summary(input_text)
12
  return out[0]["generated_text"]