ihansel
commited on
Commit
•
0b64695
1
Parent(s):
b83d9cf
QA on Doc
Browse files
app.py
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
title = "Longformer"
|
4 |
+
|
5 |
+
description = "Gradio Demo for Longformer. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."
|
6 |
+
|
7 |
+
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2004.05150' target='_blank'>Longformer: The Long-Document Transformer</a></p>"
|
8 |
+
|
9 |
+
examples = [
|
10 |
+
["""It is with great disappointment I’m writing to let you know that Optus has been a victim of a cyberattack that has resulted in the disclosure of some of your personal information.
|
11 |
+
|
12 |
+
Importantly, no financial information or passwords have been accessed. The information which has been exposed is your name, date of birth, email, phone number, address associated with your account, and the numbers of the ID documents you provided such as drivers licence number or passport number. No copies of photo IDs have been affected.
|
13 |
+
|
14 |
+
It is also important to know that Optus’ network and Optus services including mobile and home Wi-Fi aren’t affected, and no passwords were compromised, so our services remain safe to use and operate as per normal.
|
15 |
+
|
16 |
+
Upon discovering the cyberattack, we immediately took action to shut it down to protect your information. Our priority is our customers – so while our investigation is not yet complete, we wanted you to be aware of what has happened so that you can be extra vigilant at this time.
|
17 |
+
|
18 |
+
We are currently not aware of customers having suffered any harm, but we encourage you to have heightened awareness across your accounts, including:
|
19 |
+
|
20 |
+
Look out for any suspicious or unexpected activity across your online accounts, including your bank accounts. Make sure to report any fraudulent activity immediately to the related provider.
|
21 |
+
Look out for contact from scammers who may have your personal information. This may include suspicious emails, texts, phone calls or messages on social media.
|
22 |
+
Never click on any links that look suspicious and never provide your passwords, or any personal or financial information.
|
23 |
+
If people call you posing as a credible organisation and request access to your computer, always say no.
|
24 |
+
You would have seen we announced this first in the media. We did this as it was the quickest and most effective way to alert you and all our customers, while also communicating the severity of the situation through trusted media sources.
|
25 |
+
|
26 |
+
For the most up-to-date information and FAQs, go to optus.com.au. If you believe your account has been compromised, you can contact us via My Optus app – which remains the safest way to contact Optus, or call us on 133 937.
|
27 |
+
|
28 |
+
We apologise unreservedly and are devastated this could occur. We are working as hard as possible with the relevant authorities and organisations to ensure no harm comes from this unfortunate occurrence.""","longformer-base-4096-finetuned-squadv1","Who is the victim?"]
|
29 |
+
]
|
30 |
+
|
31 |
+
io1 = gr.Interface.load("huggingface/valhalla/longformer-base-4096-finetuned-squadv1")
|
32 |
+
|
33 |
+
io2 = gr.Interface.load("huggingface/allenai/longformer-large-4096-finetuned-triviaqa")
|
34 |
+
|
35 |
+
|
36 |
+
def inference(context, model,question):
|
37 |
+
if model == "longformer-base-4096-finetuned-squadv1":
|
38 |
+
outlabel = io1(context,question)
|
39 |
+
else:
|
40 |
+
outlabel = io2(context,question)
|
41 |
+
return outlabel
|
42 |
+
|
43 |
+
|
44 |
+
gr.Interface(
|
45 |
+
inference,
|
46 |
+
[gr.inputs.Textbox(label="Context",lines=10),gr.inputs.Dropdown(choices=["longformer-base-4096-finetuned-squadv1","longformer-large-4096-finetuned-triviaqa"], type="value", default="longformer-base-4096-finetuned-squadv1", label="model"),gr.inputs.Textbox(label="Question Answering")],
|
47 |
+
[gr.outputs.Textbox(label="Output")],
|
48 |
+
examples=examples,
|
49 |
+
article=article,
|
50 |
+
title=title,
|
51 |
+
description=description).launch(enable_queue=True, cache_examples=True)
|