saadob12 commited on
Commit
da1088a
1 Parent(s): 5384008

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +20 -0
README.md CHANGED
@@ -3,6 +3,26 @@
3
 
4
  **Github Link for the data**: https://github.com/vis-nlp/Chart-to-text
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  # Intended Use and Limitations
7
  You can use the model to generate summaries of data files.
8
  Works well for general statistics like the following:
 
3
 
4
  **Github Link for the data**: https://github.com/vis-nlp/Chart-to-text
5
 
6
+
7
+ # Example use:
8
+ Append ```C2T: ``` before every input to the model
9
+
10
+
11
+ ```
12
+ tokenizer = AutoTokenizer.from_pretrained(saadob12/t5_C2T_big)
13
+ model = AutoModelForSeq2SeqLM.from_pretrained(saadob12/t5_C2T_big)
14
+
15
+ data = 'Breakdown of coronavirus ( COVID-19 ) deaths in South Korea as of March 16 , 2020 , by chronic disease x-y labels Response - Share of cases, x-y values Circulatory system disease* 62.7% , Endocrine and metabolic diseases** 46.7% , Mental illness*** 25.3% , Respiratory diseases*** 24% , Urinary and genital diseases 14.7% , Cancer 13.3% , Nervous system diseases 4% , Digestive system diseases 2.7% , Blood and hematopoietic diseases 1.3%'
16
+
17
+ prefix = 'C2T: '
18
+ tokens = tokenizer.encode(prefix + data, truncation=True, padding='max_length', return_tensors='pt')
19
+ generated = model.generate(tokens, num_beams=4, max_length=256)
20
+ tgt_text = tokenizer.decode(generated[0], skip_special_tokens=True, clean_up_tokenization_spaces=True)
21
+ summary = str(tgt_text).strip('[]""')
22
+ #Summary: As of March 16, 2020, around 62.7 percent of all deaths due to the coronavirus ( COVID-19 ) in South Korea were related to circulatory system diseases. Other chronic diseases include endocrine and metabolic diseases, mental illness, and cancer. South Korea confirmed 30,017 cases of infection including 501 deaths. For further information about the coronavirus ( COVID-19 ) pandemic, please visit our dedicated Facts and Figures page.
23
+ ```
24
+
25
+
26
  # Intended Use and Limitations
27
  You can use the model to generate summaries of data files.
28
  Works well for general statistics like the following: