Spaces:
Runtime error
Runtime error
Added examples and reverted to dictionary/JSON output
Browse files
app.py
CHANGED
|
@@ -24,17 +24,23 @@ def extract_answer(question, url):
|
|
| 24 |
context = context.replace("\n\n", "\n")
|
| 25 |
|
| 26 |
answer_dict = qa_model(question = question, context = context)
|
| 27 |
-
return answer_dict
|
|
|
|
| 28 |
|
| 29 |
title = "Webpage-Based Question Answering"
|
| 30 |
description = "Using a webpage as context for extractive question answering."
|
| 31 |
enable_queue=True
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
iface = gr.Interface(
|
| 34 |
fn=extract_answer,
|
| 35 |
inputs=["text", "text"],
|
| 36 |
outputs="text",
|
| 37 |
title=title,
|
| 38 |
-
description=description
|
|
|
|
| 39 |
)
|
| 40 |
iface.launch(enable_queue=enable_queue)
|
|
|
|
| 24 |
context = context.replace("\n\n", "\n")
|
| 25 |
|
| 26 |
answer_dict = qa_model(question = question, context = context)
|
| 27 |
+
return answer_dict
|
| 28 |
+
|
| 29 |
|
| 30 |
title = "Webpage-Based Question Answering"
|
| 31 |
description = "Using a webpage as context for extractive question answering."
|
| 32 |
enable_queue=True
|
| 33 |
+
examples=[
|
| 34 |
+
["Where was Messi born?", "https://en.wikipedia.org/wiki/Lionel_Messi"],
|
| 35 |
+
["When was Cristiano Ronaldo born?", "https://en.wikipedia.org/wiki/Cristiano_Ronaldo"]
|
| 36 |
+
]
|
| 37 |
|
| 38 |
iface = gr.Interface(
|
| 39 |
fn=extract_answer,
|
| 40 |
inputs=["text", "text"],
|
| 41 |
outputs="text",
|
| 42 |
title=title,
|
| 43 |
+
description=description,
|
| 44 |
+
examples=examples
|
| 45 |
)
|
| 46 |
iface.launch(enable_queue=enable_queue)
|