arpm01 commited on
Commit
cbf1d0c
1 Parent(s): c437916

add examples

Browse files
Files changed (2) hide show
  1. app.py +9 -8
  2. text2.txt +9 -0
app.py CHANGED
@@ -1,21 +1,22 @@
1
  import gradio as gr
2
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
3
 
4
- #tokenizer = AutoTokenizer.from_pretrained("human-centered-summarization/financial-summarization-pegasus")
5
-
6
- #model = AutoModelForSeq2SeqLM.from_pretrained("human-centered-summarization/financial-summarization-pegasus")
7
-
8
- #pipe = pipeline(task="summarization",
9
- #model=model,
10
- #tokenizer=tokenizer,)
11
 
12
  pipe = pipeline(task="text2text-generation", model = "human-centered-summarization/financial-summarization-pegasus")
13
 
14
  with open('text1.txt') as f:
15
  text1 = f.read()
16
 
 
 
 
17
  gr.Interface.from_pipeline(pipe,
18
  title="Financial Summarization",
19
  description="Financial Summarization using Pegasus. Model can be found at https://huggingface.co/human-centered-summarization/financial-summarization-pegasus",
20
- examples=[text1]
21
  ).launch()
 
1
  import gradio as gr
2
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
3
 
4
+ # tokenizer = AutoTokenizer.from_pretrained("human-centered-summarization/financial-summarization-pegasus")
5
+ # model = AutoModelForSeq2SeqLM.from_pretrained("human-centered-summarization/financial-summarization-pegasus")
6
+ # pipe = pipeline(task="summarization",
7
+ # model=model,
8
+ # tokenizer=tokenizer,)
 
 
9
 
10
  pipe = pipeline(task="text2text-generation", model = "human-centered-summarization/financial-summarization-pegasus")
11
 
12
  with open('text1.txt') as f:
13
  text1 = f.read()
14
 
15
+ with open('text2.txt') as f:
16
+ text2 = f.read()
17
+
18
  gr.Interface.from_pipeline(pipe,
19
  title="Financial Summarization",
20
  description="Financial Summarization using Pegasus. Model can be found at https://huggingface.co/human-centered-summarization/financial-summarization-pegasus",
21
+ examples=[text1,text2]
22
  ).launch()
text2.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ Budget carrier Cebu Pacific saw its net loss widen to P24.9 billion last year from P22.2 billion in 2020 as a fresh surge in COVID-19 cases resulted in fewer flights and passengers.
2
+
3
+ The rollout of vaccinations beginning in March last year sparked optimism for normalization of operations but the Delta variant derailed the path to recovery, Cebu Pacific said in a disclosure on Wednesday.
4
+
5
+ “[As] new COVID-19 variants emerged and cases surged, strict lockdowns were once again implemented which tempered growth of Cebu Pacific’s operational and financial performance,” the low-cost airline said.
6
+
7
+ It flew 3.4 million passengers via 34,463 flights last year, lower than 5 million passengers via 41,804 flights in 2020.
8
+
9
+ Total revenues for the period dropped by 30 percent to P15.7 billion as passenger revenues fell by 50 percent to P6.3 billion from P12.6 billion year-on-year. Revenues from cargo operations, meanwhile, rose by 20 percent to P6.5 billion last year.