kinit-tomassako commited on
Commit
c7197dc
1 Parent(s): ab48543

Add app file

Browse files
Files changed (1) hide show
  1. app.py +58 -0
app.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests as rq
3
+ import os
4
+ os.environ['CURL_CA_BUNDLE'] = ''
5
+ description = "Vera - Claim detection & Summary"
6
+ title = "Vera - Claim detection & Summary"
7
+
8
+ #def sentence_builder(input_text, claimdet_drp):
9
+ # return f"""The {quantity} {animal}s from {" and ".join(countries)} went to the {place} where they {" and ".join(activity_list)} until the {"morning" if morning else "night"}"""
10
+
11
+ # @greet_btn.click(inputs=input_text, outputs=output)
12
+ def sentence_builder(input_text, claimdet_drp):
13
+ # print("label: "+claimdet_drp.label)
14
+ # print("value: "+str(claimdet_drp.value))
15
+ # print(f"""brackets: {claimdet_drp}""")
16
+ # url = "https://gvyre1ron7.execute-api.eu-central-1.amazonaws.com/prod"
17
+ url = None
18
+ match claimdet_drp:
19
+ case "Mdeberta":
20
+ url = "https://gvyre1ron7.execute-api.eu-central-1.amazonaws.com/prod"
21
+ case "Xlm-Roberta":
22
+ url = "https://b3vbb5xexg.execute-api.eu-central-1.amazonaws.com/prod"
23
+ ## case _:
24
+ ## url = None
25
+ # payload = "[\"The novel SARS-CoV-2 coronavirus that emerged in the city of Wuhan, China, last year and has since caused a large scale COVID-19 epidemic and spread to more than 70 other countries is the product of natural evolution, according to findings published today in the journal Nature Medicine. The analysis of public genome sequence data from SARS-CoV-2 and related viruses found no evidence that the virus was made in a laboratory or otherwise engineered. Coronaviruses are a large family of viruses that can cause illnesses ranging widely in severity. The first known severe illness caused by a coronavirus emerged with the 2003 Severe Acute Respiratory Syndrome (SARS) epidemic in China. A second outbreak of severe illness began in 2012 in Saudi Arabia with the Middle East Respiratory Syndrome (MERS). On December 31 of last year, Chinese authorities alerted the World Health Organization of an outbreak of a novel strain of coronavirus causing severe illness, which was subsequently named SARS-CoV-2. As of February 20, 2020, nearly 167,500 COVID-19 cases have been documented, although many more mild cases have likely gone undiagnosed. The virus has killed over 6,600 people. Shortly after the epidemic began, Chinese scientists sequenced the genome of SARS-CoV-2 and made the data available to researchers worldwide. The resulting genomic sequence data has shown that Chinese authorities rapidly detected the epidemic and that the number of COVID-19 cases have been increasing because of human to human transmission after a single introduction into the human population. Andersen and collaborators at several other research institutions used this sequencing data to explore the origins and evolution of SARS-CoV-2 by focusing in on several tell-tale features of the virus. The scientists analyzed the genetic template for spike proteins, armatures on the outside of the virus that it uses to grab and penetrate the outer walls of human and animal cells.\"]"
26
+ payload = "['"+input_text+"']"
27
+ headers = {
28
+ 'Content-Type': 'text/plain'
29
+ }
30
+ response = rq.request("POST", url, headers=headers, data=payload)
31
+ return f"""{claimdet_drp} response: """ + str(response.content)
32
+
33
+ ver_claimdetection_demo = gr.Interface(
34
+ sentence_builder,
35
+ [
36
+ gr.Textbox(label="Input Text"),
37
+ # gr.Textbox(label="Output Box",
38
+ # gr.Button("Greet"),
39
+ gr.Dropdown(["Mdeberta", "Xlm-Roberta"], label="Choose ClaimDetection model", info="Choose ClaimDetection model"),
40
+ ],
41
+ "text",
42
+ description=description,
43
+ examples=[
44
+ ["The novel SARS-CoV-2 coronavirus that emerged in the city of Wuhan, China, last year and has since caused a large scale COVID-19 epidemic and spread to more than 70 other countries is the product of natural evolution, according to findings published today in the journal Nature Medicine. The analysis of public genome sequence data from SARS-CoV-2 and related viruses found no evidence that the virus was made in a laboratory or otherwise engineered. Coronaviruses are a large family of viruses that can cause illnesses ranging widely in severity. The first known severe illness caused by a coronavirus emerged with the 2003 Severe Acute Respiratory Syndrome (SARS) epidemic in China. A second outbreak of severe illness began in 2012 in Saudi Arabia with the Middle East Respiratory Syndrome (MERS). On December 31 of last year, Chinese authorities alerted the World Health Organization of an outbreak of a novel strain of coronavirus causing severe illness, which was subsequently named SARS-CoV-2. As of February 20, 2020, nearly 167,500 COVID-19 cases have been documented, although many more mild cases have likely gone undiagnosed. The virus has killed over 6,600 people. Shortly after the epidemic began, Chinese scientists sequenced the genome of SARS-CoV-2 and made the data available to researchers worldwide. The resulting genomic sequence data has shown that Chinese authorities rapidly detected the epidemic and that the number of COVID-19 cases have been increasing because of human to human transmission after a single introduction into the human population. Andersen and collaborators at several other research institutions used this sequencing data to explore the origins and evolution of SARS-CoV-2 by focusing in on several tell-tale features of the virus. The scientists analyzed the genetic template for spike proteins, armatures on the outside of the virus that it uses to grab and penetrate the outer walls of human and animal cells.", "Mdeberta"],
45
+ ["I do not know. Of course we can. The novel SARS-CoV-2 coronavirus emerged in the city of Wuhan, China, last year.", "Xlm-Roberta"],
46
+ ]
47
+ )
48
+
49
+ #with gr.Blocks() as ver_claimdetection_demo:
50
+ # input_text = gr.Textbox(label="Input Text")
51
+ # output = gr.Textbox(label="Output Box")
52
+ # greet_btn = gr.Button("Greet")
53
+ # claimdet_drp = gr.Dropdown(["Mdeberta", "Xlm-Roberta"], label="Choose ClaimDetection model", info="Choose ClaimDetection model")
54
+
55
+
56
+ # "Mdeberta", "https://gvyre1ron7.execute-api.eu-central-1.amazonaws.com/prod"
57
+ # "Xlm-Roberta", "https://b3vbb5xexg.execute-api.eu-central-1.amazonaws.com/prod"
58
+ ver_claimdetection_demo.launch(share=True)