jedick commited on
Commit
5069c9d
Β·
1 Parent(s): 6ecddd5

Regroup examples

Browse files
app.py CHANGED
@@ -55,9 +55,9 @@ with gr.Blocks() as demo:
55
 
56
  # Layout
57
  with gr.Row():
58
- with gr.Column(scale=3):
59
  with gr.Row():
60
- with gr.Column(scale=2):
61
  gr.Markdown(
62
  """
63
  # AI4citations: AI-powered citation verification
@@ -68,14 +68,13 @@ with gr.Blocks() as demo:
68
  - Or press **Shift-Enter** in any text box
69
  """
70
  )
71
- with gr.Column(scale=3):
72
  claim = gr.TextArea(
73
  label="Claim",
74
- info="aka hypothesis",
75
  placeholder="1. Input a claim",
76
  )
77
  with gr.Row():
78
- with gr.Column(scale=2):
79
  with gr.Accordion("Get Evidence from PDF"):
80
  pdf_file = gr.File(
81
  label="Upload PDF", type="filepath", height=120
@@ -95,11 +94,11 @@ with gr.Blocks() as demo:
95
  label="Top k sentences",
96
  )
97
  get_evidence = gr.Button(value="Get Evidence and Submit")
98
- with gr.Column(scale=3):
99
  evidence = gr.TextArea(
100
  label="Evidence",
101
- info="aka premise",
102
- placeholder="2. Input evidence or use Get Evidence from PDF",
103
  )
104
  with gr.Row():
105
  prompt_tokens = gr.Number(label="Prompt tokens", visible=False)
@@ -108,7 +107,7 @@ with gr.Blocks() as demo:
108
  )
109
  prediction = gr.Label(label="Prediction")
110
 
111
- with gr.Column(scale=2):
112
  # Create dropdown menu to select the model
113
  model = gr.Dropdown(
114
  choices=[
@@ -124,31 +123,14 @@ with gr.Blocks() as demo:
124
  )
125
  with gr.Accordion("Examples"):
126
  gr.Markdown("*Examples are run when clicked*"),
127
- with gr.Row():
128
- support_example = gr.Examples(
129
- examples="examples/Support",
130
- label="Support",
131
- inputs=[claim, evidence],
132
- example_labels=pd.read_csv("examples/Support/log.csv")[
133
- "label"
134
- ].tolist(),
135
- )
136
- nei_example = gr.Examples(
137
- examples="examples/NEI",
138
- label="NEI",
139
- inputs=[claim, evidence],
140
- example_labels=pd.read_csv("examples/NEI/log.csv")[
141
- "label"
142
- ].tolist(),
143
- )
144
- refute_example = gr.Examples(
145
- examples="examples/Refute",
146
- label="Refute",
147
- inputs=[claim, evidence],
148
- example_labels=pd.read_csv("examples/Refute/log.csv")[
149
- "label"
150
- ].tolist(),
151
- )
152
  retrieval_example = gr.Examples(
153
  examples="examples/retrieval",
154
  label="Get Evidence from PDF",
@@ -381,39 +363,11 @@ with gr.Blocks() as demo:
381
  api_name=False,
382
  )
383
 
384
- # Handle "Support" examples
385
- gr.on(
386
- triggers=[support_example.dataset.select],
387
- fn=select_example,
388
- inputs=support_example.dataset,
389
- outputs=[claim, evidence],
390
- api_name=False,
391
- ).then(
392
- fn=query_model,
393
- inputs=[claim, evidence],
394
- outputs=prediction,
395
- api_name=False,
396
- )
397
-
398
- # Handle "NEI" examples
399
- gr.on(
400
- triggers=[nei_example.dataset.select],
401
- fn=select_example,
402
- inputs=nei_example.dataset,
403
- outputs=[claim, evidence],
404
- api_name=False,
405
- ).then(
406
- fn=query_model,
407
- inputs=[claim, evidence],
408
- outputs=prediction,
409
- api_name=False,
410
- )
411
-
412
- # Handle "Refute" examples
413
  gr.on(
414
- triggers=[refute_example.dataset.select],
415
  fn=select_example,
416
- inputs=refute_example.dataset,
417
  outputs=[claim, evidence],
418
  api_name=False,
419
  ).then(
 
55
 
56
  # Layout
57
  with gr.Row():
58
+ with gr.Column(scale=2):
59
  with gr.Row():
60
+ with gr.Column(scale=1):
61
  gr.Markdown(
62
  """
63
  # AI4citations: AI-powered citation verification
 
68
  - Or press **Shift-Enter** in any text box
69
  """
70
  )
71
+ with gr.Column(scale=2):
72
  claim = gr.TextArea(
73
  label="Claim",
 
74
  placeholder="1. Input a claim",
75
  )
76
  with gr.Row():
77
+ with gr.Column(scale=1):
78
  with gr.Accordion("Get Evidence from PDF"):
79
  pdf_file = gr.File(
80
  label="Upload PDF", type="filepath", height=120
 
94
  label="Top k sentences",
95
  )
96
  get_evidence = gr.Button(value="Get Evidence and Submit")
97
+ with gr.Column(scale=2):
98
  evidence = gr.TextArea(
99
  label="Evidence",
100
+ info="Shift-Enter to submit",
101
+ placeholder="2. Input evidence",
102
  )
103
  with gr.Row():
104
  prompt_tokens = gr.Number(label="Prompt tokens", visible=False)
 
107
  )
108
  prediction = gr.Label(label="Prediction")
109
 
110
+ with gr.Column(scale=1):
111
  # Create dropdown menu to select the model
112
  model = gr.Dropdown(
113
  choices=[
 
123
  )
124
  with gr.Accordion("Examples"):
125
  gr.Markdown("*Examples are run when clicked*"),
126
+ claims_example = gr.Examples(
127
+ examples="examples/claims",
128
+ label="Support, NEI, Refute (1, 2, 3)",
129
+ inputs=[claim, evidence],
130
+ example_labels=pd.read_csv("examples/claims/log.csv")[
131
+ "label"
132
+ ].tolist(),
133
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  retrieval_example = gr.Examples(
135
  examples="examples/retrieval",
136
  label="Get Evidence from PDF",
 
363
  api_name=False,
364
  )
365
 
366
+ # Handle examples
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  gr.on(
368
+ triggers=[claims_example.dataset.select],
369
  fn=select_example,
370
+ inputs=claims_example.dataset,
371
  outputs=[claim, evidence],
372
  api_name=False,
373
  ).then(
examples/NEI/log.csv DELETED
@@ -1,3 +0,0 @@
1
- claim,evidence,label
2
- "0-dimensional biomaterials lack inductive properties.","Nanotechnologies are emerging platforms that could be useful in measuring, understanding, and manipulating stem cells. Examples include magnetic nanoparticles and quantum dots for stem cell labeling and in vivo tracking; nanoparticles, carbon nanotubes, and polyplexes for the intracellular delivery of genes/oligonucleotides and protein/peptides; and engineered nanometer-scale scaffolds for stem cell differentiation and transplantation. This review examines the use of nanotechnologies for stem cell tracking, differentiation, and transplantation. We further discuss their utility and the potential concerns regarding their cytotoxicity.",SciFact
3
- "This high AMP/ATP ratio activates the phosphorylation of AMPK, a master energy sensor within cell, and then pAMPK inhibits mTOR signaling by activating TSC2 and subsequently inhibiting Rheb","When electron transport function is inhibited, the ATP synthase can function in reverse such that it uses ATP generated by glycolysis to pump protons across the inner mitochondrial membrane, maintaining membrane potential (Appleby et al., 1999). This latter hypothesis has been questioned as cancer cells have the ability to survive on ATP produced exclusively by glycolysis. The ATP synthase inhibitor, Oligomycin A, diminished TMRE fluorescence in Control-HCT 116 p53βˆ’/βˆ’ cells treated with metformin suggesting that in the presence of metformin, intact cells maintain their mitochondrial membrane potential by reversal of the ATP synthase (Figure 4E). Metformin inhibits cellular proliferation and pro- proliferative signaling via complex I inhibition. It is likely that metformin acts upstream of this site, inhibiting complex I activity while also inhibiting ROS generation.",CitInt
 
 
 
 
examples/Refute/log.csv DELETED
@@ -1,3 +0,0 @@
1
- claim,evidence,label
2
- "1 in 5 million in UK have abnormal PrP positivity.","OBJECTIVES To carry out a further survey of archived appendix samples to understand better the differences between existing estimates of the prevalence of subclinical infection with prions after the bovine spongiform encephalopathy epizootic and to see whether a broader birth cohort was affected, and to understand better the implications for the management of blood and blood products and for the handling of surgical instruments. DESIGN Irreversibly unlinked and anonymised large scale survey of archived appendix samples. SETTING Archived appendix samples from the pathology departments of 41 UK hospitals participating in the earlier survey, and additional hospitals in regions with lower levels of participation in that survey. SAMPLE 32,441 archived appendix samples fixed in formalin and embedded in paraffin and tested for the presence of abnormal prion protein (PrP). RESULTS Of the 32,441 appendix samples 16 were positive for abnormal PrP, indicating an overall prevalence of 493 per million population (95% confidence interval 282 to 801 per million). The prevalence in those born in 1941-60 (733 per million, 269 to 1596 per million) did not differ significantly from those born between 1961 and 1985 (412 per million, 198 to 758 per million) and was similar in both sexes and across the three broad geographical areas sampled. Genetic testing of the positive specimens for the genotype at PRNP codon 129 revealed a high proportion that were valine homozygous compared with the frequency in the normal population, and in stark contrast with confirmed clinical cases of vCJD, all of which were methionine homozygous at PRNP codon 129. CONCLUSIONS This study corroborates previous studies and suggests a high prevalence of infection with abnormal PrP, indicating vCJD carrier status in the population compared with the 177 vCJD cases to date. These findings have important implications for the management of blood and blood products and for the handling of surgical instruments.",SciFact
3
- "Poirot was now back and I was sorry that he would take over what I now considered my own investigation.","Poirot, I exclaimed, with relief, and seizing him by both hands, I dragged him into the room.",MNLI
 
 
 
 
examples/{Support β†’ claims}/log.csv RENAMED
@@ -1,3 +1,7 @@
1
  claim,evidence,label
2
- "32% of liver transplantation programs required patients to discontinue methadone treatment in 2001.","ContextChronic hepatitis C is the leading cause for liver transplantation in the United States. Intravenous drug use, the major risk factor, accounts for approximately 60% of hepatitis C virus transmission. Information from the United Network of Organ Sharing (UNOS) does not address substance use among liver transplantation patients. ObjectiveTo identify addiction-related criteria for admission to the UNOS liver transplantation waiting list and posttransplantation problems experienced by patients who are prescribed maintenance methadone. Design, Setting, and ParticipantsMail survey of all 97 adult US liver transplantation programs (belonging to UNOS) in March 2000 with telephone follow-up conducted in May and June 2000.Main Outcome MeasuresPrograms' acceptance and management of patients with past or present substance use disorder. ResultsOf the 97 programs surveyed, 87 (90%) responded. All accept applicants with a history of alcoholism or other addictions, including heroin dependence. Eighty-eight percent of the responding programs require at least 6 months of abstinence from alcohol; 83% from illicit drugs. Ninety-four percent have addiction treatment requirements. Consultations from substance abuse specialists are obtained by 86%. Patients receiving methadone maintenance are accepted by 56% of the responding programs. Approximately 180 patients receiving methadone maintenance are reported to have undergone liver transplantation. ConclusionsMost liver transplantation programs have established policies for patients with substance use disorders. Opiate-dependent patients receiving opiate replacement therapy seem underrepresented in transplantation programs. Little anecdotal evidence for negative impact of opiate replacement therapy on liver transplantation outcome was found. Policies requiring discontinuation of methadone in 32% of all programs contradict the evidence base for efficacy of long-term replacement therapies and potentially result in relapse of previously stable patients.",SciFact
3
- "Several studies have also shown the association of non-coding RNAs in colorectal carcinogenesis through the stimulation or inhibition of apoptosis, cell proliferation, differentiation, invasion and metastasis","Accumulating evidence indicates that lncRNAs could play a critical role in regulation of cellular processes such as cell growth and apoptosis as well as cancer progression and metastasis. In colon cancer, a recent report indicated that miR-211 promotes cell proliferation, tumor growth and cell migration of HCT-116 cells. Although they are less well characterized compared with small non- coding microRNAs (1–5), increasing evidence suggests that lncRNAs could play a critical role in regulation of diverse cellular processes such as stem cell pluripotency, development, cell growth and apoptosis and cancer metastasis (6–13). For example, miR-211 enhances the proliferation, migration and anchorage-independent colony formation of oral carcinoma cells (35). Alterations in the primary structure, secondary structure and expression levels of lncRNAs as well as their cognate RNA-binding proteins are often associated with human diseases, in particular cancer (36).",CitInt
 
 
 
 
 
1
  claim,evidence,label
2
+ "32% of liver transplantation programs required patients to discontinue methadone treatment in 2001.","ContextChronic hepatitis C is the leading cause for liver transplantation in the United States. Intravenous drug use, the major risk factor, accounts for approximately 60% of hepatitis C virus transmission. Information from the United Network of Organ Sharing (UNOS) does not address substance use among liver transplantation patients. ObjectiveTo identify addiction-related criteria for admission to the UNOS liver transplantation waiting list and posttransplantation problems experienced by patients who are prescribed maintenance methadone. Design, Setting, and ParticipantsMail survey of all 97 adult US liver transplantation programs (belonging to UNOS) in March 2000 with telephone follow-up conducted in May and June 2000.Main Outcome MeasuresPrograms' acceptance and management of patients with past or present substance use disorder. ResultsOf the 97 programs surveyed, 87 (90%) responded. All accept applicants with a history of alcoholism or other addictions, including heroin dependence. Eighty-eight percent of the responding programs require at least 6 months of abstinence from alcohol; 83% from illicit drugs. Ninety-four percent have addiction treatment requirements. Consultations from substance abuse specialists are obtained by 86%. Patients receiving methadone maintenance are accepted by 56% of the responding programs. Approximately 180 patients receiving methadone maintenance are reported to have undergone liver transplantation. ConclusionsMost liver transplantation programs have established policies for patients with substance use disorders. Opiate-dependent patients receiving opiate replacement therapy seem underrepresented in transplantation programs. Little anecdotal evidence for negative impact of opiate replacement therapy on liver transplantation outcome was found. Policies requiring discontinuation of methadone in 32% of all programs contradict the evidence base for efficacy of long-term replacement therapies and potentially result in relapse of previously stable patients.","SciFact 1"
3
+ "0-dimensional biomaterials lack inductive properties.","Nanotechnologies are emerging platforms that could be useful in measuring, understanding, and manipulating stem cells. Examples include magnetic nanoparticles and quantum dots for stem cell labeling and in vivo tracking; nanoparticles, carbon nanotubes, and polyplexes for the intracellular delivery of genes/oligonucleotides and protein/peptides; and engineered nanometer-scale scaffolds for stem cell differentiation and transplantation. This review examines the use of nanotechnologies for stem cell tracking, differentiation, and transplantation. We further discuss their utility and the potential concerns regarding their cytotoxicity.","SciFact 2"
4
+ "1 in 5 million in UK have abnormal PrP positivity.","OBJECTIVES To carry out a further survey of archived appendix samples to understand better the differences between existing estimates of the prevalence of subclinical infection with prions after the bovine spongiform encephalopathy epizootic and to see whether a broader birth cohort was affected, and to understand better the implications for the management of blood and blood products and for the handling of surgical instruments. DESIGN Irreversibly unlinked and anonymised large scale survey of archived appendix samples. SETTING Archived appendix samples from the pathology departments of 41 UK hospitals participating in the earlier survey, and additional hospitals in regions with lower levels of participation in that survey. SAMPLE 32,441 archived appendix samples fixed in formalin and embedded in paraffin and tested for the presence of abnormal prion protein (PrP). RESULTS Of the 32,441 appendix samples 16 were positive for abnormal PrP, indicating an overall prevalence of 493 per million population (95% confidence interval 282 to 801 per million). The prevalence in those born in 1941-60 (733 per million, 269 to 1596 per million) did not differ significantly from those born between 1961 and 1985 (412 per million, 198 to 758 per million) and was similar in both sexes and across the three broad geographical areas sampled. Genetic testing of the positive specimens for the genotype at PRNP codon 129 revealed a high proportion that were valine homozygous compared with the frequency in the normal population, and in stark contrast with confirmed clinical cases of vCJD, all of which were methionine homozygous at PRNP codon 129. CONCLUSIONS This study corroborates previous studies and suggests a high prevalence of infection with abnormal PrP, indicating vCJD carrier status in the population compared with the 177 vCJD cases to date. These findings have important implications for the management of blood and blood products and for the handling of surgical instruments.","SciFact 3"
5
+ "Several studies have also shown the association of non-coding RNAs in colorectal carcinogenesis through the stimulation or inhibition of apoptosis, cell proliferation, differentiation, invasion and metastasis","Accumulating evidence indicates that lncRNAs could play a critical role in regulation of cellular processes such as cell growth and apoptosis as well as cancer progression and metastasis. In colon cancer, a recent report indicated that miR-211 promotes cell proliferation, tumor growth and cell migration of HCT-116 cells. Although they are less well characterized compared with small non- coding microRNAs (1–5), increasing evidence suggests that lncRNAs could play a critical role in regulation of diverse cellular processes such as stem cell pluripotency, development, cell growth and apoptosis and cancer metastasis (6–13). For example, miR-211 enhances the proliferation, migration and anchorage-independent colony formation of oral carcinoma cells (35). Alterations in the primary structure, secondary structure and expression levels of lncRNAs as well as their cognate RNA-binding proteins are often associated with human diseases, in particular cancer (36).","CitInt 1"
6
+ "This high AMP/ATP ratio activates the phosphorylation of AMPK, a master energy sensor within cell, and then pAMPK inhibits mTOR signaling by activating TSC2 and subsequently inhibiting Rheb","When electron transport function is inhibited, the ATP synthase can function in reverse such that it uses ATP generated by glycolysis to pump protons across the inner mitochondrial membrane, maintaining membrane potential (Appleby et al., 1999). This latter hypothesis has been questioned as cancer cells have the ability to survive on ATP produced exclusively by glycolysis. The ATP synthase inhibitor, Oligomycin A, diminished TMRE fluorescence in Control-HCT 116 p53βˆ’/βˆ’ cells treated with metformin suggesting that in the presence of metformin, intact cells maintain their mitochondrial membrane potential by reversal of the ATP synthase (Figure 4E). Metformin inhibits cellular proliferation and pro- proliferative signaling via complex I inhibition. It is likely that metformin acts upstream of this site, inhibiting complex I activity while also inhibiting ROS generation.","CitInt 2"
7
+ "Poirot was now back and I was sorry that he would take over what I now considered my own investigation.","Poirot, I exclaimed, with relief, and seizing him by both hands, I dragged him into the room.","MNLI 3"
examples/retrieval/log.csv CHANGED
@@ -1,5 +1,5 @@
1
  pdf_file,claim,label
2
- https://journals.plos.org/plosmedicine/article/file?id=10.1371/journal.pmed.0030197&type=printable,"Falsified artemisinin family drugs with no active ingredient can be life-threatening.","SciFact (Support)"
3
- CRISPR.pdf,"CRISPR is DNA and Cas is protein","CRISPR (Support)"
4
- CRISPR.pdf,"CRISPR is RNA and Cas is protein","CRISPR (NEI)"
5
- CRISPR.pdf,"CRISPR is protein and Cas is DNA","CRISPR (Refute)"
 
1
  pdf_file,claim,label
2
+ https://journals.plos.org/plosmedicine/article/file?id=10.1371/journal.pmed.0030197&type=printable,"Falsified artemisinin family drugs with no active ingredient can be life-threatening.","SciFact 1"
3
+ CRISPR.pdf,"CRISPR is DNA and Cas is protein","CRISPR 1"
4
+ CRISPR.pdf,"CRISPR is RNA and Cas is protein","CRISPR 2"
5
+ CRISPR.pdf,"CRISPR is protein and Cas is DNA","CRISPR 3"