Spaces:
Runtime error
Runtime error
Benjamin Consolvo
commited on
Commit
·
3ecf378
1
Parent(s):
ba7c814
inputs fix
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ def predict(context,question):
|
|
29 |
dense_predictions = dense_qa_pipeline(context=context,question=question)
|
30 |
dense_end_time = time.perf_counter()
|
31 |
dense_duration = (dense_end_time - dense_start_time) * 1000
|
32 |
-
dense_answer =
|
33 |
|
34 |
return sparse_answer,sparse_duration,dense_answer,dense_duration
|
35 |
|
@@ -57,9 +57,10 @@ dense_duration=gr.Text(label="Dense latency (ms)")
|
|
57 |
|
58 |
apple_context = "An apple is an edible fruit produced by an apple tree (Malus domestica). Apple trees are cultivated worldwide and are the most widely grown species in the genus Malus. The tree originated in Central Asia, where its wild ancestor, Malus sieversii, is still found today. Apples have been grown for thousands of years in Asia and Europe and were brought to North America by European colonists. Apples have religious and mythological significance in many cultures, including Norse, Greek, and European Christian tradition. Apples grown from seed tend to be very different from those of their parents, and the resultant fruit frequently lacks desired characteristics. Generally, apple cultivars are propagated by clonal grafting onto rootstocks. Apple trees grown without rootstocks tend to be larger and much slower to fruit after planting. Rootstocks are used to control the speed of growth and the size of the resulting tree, allowing for easier harvesting."
|
59 |
apple_question = "How many years have apples been grown for?"
|
|
|
60 |
iface = gr.Interface(
|
61 |
fn=predict,
|
62 |
-
inputs=[
|
63 |
outputs=[sparse_answer,sparse_duration,dense_answer,dense_duration],
|
64 |
examples=[[apple_context,apple_question]],
|
65 |
title = "Question & Answer with Sparse BERT using the SQuAD dataset",
|
|
|
29 |
dense_predictions = dense_qa_pipeline(context=context,question=question)
|
30 |
dense_end_time = time.perf_counter()
|
31 |
dense_duration = (dense_end_time - dense_start_time) * 1000
|
32 |
+
dense_answer = dense_predictions['answer']
|
33 |
|
34 |
return sparse_answer,sparse_duration,dense_answer,dense_duration
|
35 |
|
|
|
57 |
|
58 |
apple_context = "An apple is an edible fruit produced by an apple tree (Malus domestica). Apple trees are cultivated worldwide and are the most widely grown species in the genus Malus. The tree originated in Central Asia, where its wild ancestor, Malus sieversii, is still found today. Apples have been grown for thousands of years in Asia and Europe and were brought to North America by European colonists. Apples have religious and mythological significance in many cultures, including Norse, Greek, and European Christian tradition. Apples grown from seed tend to be very different from those of their parents, and the resultant fruit frequently lacks desired characteristics. Generally, apple cultivars are propagated by clonal grafting onto rootstocks. Apple trees grown without rootstocks tend to be larger and much slower to fruit after planting. Rootstocks are used to control the speed of growth and the size of the resulting tree, allowing for easier harvesting."
|
59 |
apple_question = "How many years have apples been grown for?"
|
60 |
+
|
61 |
iface = gr.Interface(
|
62 |
fn=predict,
|
63 |
+
inputs=[context,question],
|
64 |
outputs=[sparse_answer,sparse_duration,dense_answer,dense_duration],
|
65 |
examples=[[apple_context,apple_question]],
|
66 |
title = "Question & Answer with Sparse BERT using the SQuAD dataset",
|