Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
•
e12e22b
1
Parent(s):
5642999
Update app.py
Browse files
app.py
CHANGED
@@ -10,4 +10,27 @@ examples = [
|
|
10 |
["""The Amazon rainforest (Portuguese: Floresta Amazônica or Amazônia; Spanish: Selva Amazónica, Amazonía or usually Amazonia; French: Forêt amazonienne; Dutch: Amazoneregenwoud), also known in English as Amazonia or the Amazon Jungle, is a moist broadleaf forest that covers most of the Amazon basin of South America. This basin encompasses 7,000,000 square kilometres (2,700,000 sq mi), of which 5,500,000 square kilometres (2,100,000 sq mi) are covered by the rainforest. This region includes territory belonging to nine nations. The majority of the forest is contained within Brazil, with 60% of the rainforest, followed by Peru with 13%, Colombia with 10%, and with minor amounts in Venezuela, Ecuador, Bolivia, Guyana, Suriname and French Guiana. States or departments in four nations contain "Amazonas" in their names. The Amazon represents over half of the planet's remaining rainforests, and comprises the largest and most biodiverse tract of tropical rainforest in the world, with an estimated 390 billion individual trees divided into 16,000 species.""","Which name is also used to describe the Amazon rainforest in English?"]
|
11 |
]
|
12 |
|
13 |
-
gr.Interface.load("huggingface/valhalla/longformer-base-4096-finetuned-squadv1"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
["""The Amazon rainforest (Portuguese: Floresta Amazônica or Amazônia; Spanish: Selva Amazónica, Amazonía or usually Amazonia; French: Forêt amazonienne; Dutch: Amazoneregenwoud), also known in English as Amazonia or the Amazon Jungle, is a moist broadleaf forest that covers most of the Amazon basin of South America. This basin encompasses 7,000,000 square kilometres (2,700,000 sq mi), of which 5,500,000 square kilometres (2,100,000 sq mi) are covered by the rainforest. This region includes territory belonging to nine nations. The majority of the forest is contained within Brazil, with 60% of the rainforest, followed by Peru with 13%, Colombia with 10%, and with minor amounts in Venezuela, Ecuador, Bolivia, Guyana, Suriname and French Guiana. States or departments in four nations contain "Amazonas" in their names. The Amazon represents over half of the planet's remaining rainforests, and comprises the largest and most biodiverse tract of tropical rainforest in the world, with an estimated 390 billion individual trees divided into 16,000 species.""","Which name is also used to describe the Amazon rainforest in English?"]
|
11 |
]
|
12 |
|
13 |
+
io1 = gr.Interface.load("huggingface/valhalla/longformer-base-4096-finetuned-squadv1")
|
14 |
+
|
15 |
+
io1 = gr.Interface.load("huggingface/allenai/longformer-large-4096-finetuned-triviaqa")
|
16 |
+
|
17 |
+
|
18 |
+
def inference(context, model,question):
|
19 |
+
if model == "longformer-base-4096-finetuned-squadv1":
|
20 |
+
outlabel = io1(context,question)
|
21 |
+
else:
|
22 |
+
outlabel = io2(context,question)
|
23 |
+
return outlabel
|
24 |
+
|
25 |
+
|
26 |
+
gr.Interface(
|
27 |
+
inference,
|
28 |
+
[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")],
|
29 |
+
[gr.outputs.Textbox(label="Output")],
|
30 |
+
examples=examples,
|
31 |
+
article=article,
|
32 |
+
title=title,
|
33 |
+
description=description).launch(enable_queue=True, cache_examples=True)
|
34 |
+
|
35 |
+
|
36 |
+
|