FAQA / app.py
ihansel
Move Cache Examples
de58e2b
raw
history blame contribute delete
No virus
3.76 kB
import gradio as gr
title = "Longformer"
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."
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2004.05150' target='_blank'>Longformer: The Long-Document Transformer</a></p>"
examples = [
["""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.
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.
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.
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.
We are currently not aware of customers having suffered any harm, but we encourage you to have heightened awareness across your accounts, including:
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.
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.
Never click on any links that look suspicious and never provide your passwords, or any personal or financial information.
If people call you posing as a credible organisation and request access to your computer, always say no.
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.
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.
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?"]
]
io1 = gr.Interface.load("huggingface/valhalla/longformer-base-4096-finetuned-squadv1")
io2 = gr.Interface.load("huggingface/allenai/longformer-large-4096-finetuned-triviaqa")
def inference(context, model,question):
if model == "longformer-base-4096-finetuned-squadv1":
outlabel = io1(context,question)
else:
outlabel = io2(context,question)
return outlabel
gr.Interface(
inference,
[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")],
[gr.outputs.Textbox(label="Output")],
examples=examples,
article=article,
title=title,
description=description,
cache_examples=True).launch(enable_queue=True)