Spaces:
Runtime error
Runtime error
Commit
·
06ccb0a
1
Parent(s):
2b0b74a
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ if __name__ == "__main__":
|
|
15 |
|
16 |
def get_answer(question, context):
|
17 |
|
18 |
-
encoding = tokenizer(question, context, return_tensors="jax", max_length=
|
19 |
start_scores, end_scores = forward(**encoding).to_tuple()
|
20 |
|
21 |
# Let's take the most likely token using `argmax` and retrieve the answer
|
@@ -30,4 +30,7 @@ if __name__ == "__main__":
|
|
30 |
question = gr.inputs.Textbox(lines=2, default="Who added BigBird to HuggingFace Transformers?", label="Question")
|
31 |
context = gr.inputs.Textbox(lines=10, default=default_context, label="Context")
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
15 |
|
16 |
def get_answer(question, context):
|
17 |
|
18 |
+
encoding = tokenizer(question, context, return_tensors="jax", max_length=4096, padding="max_length", truncation=True)
|
19 |
start_scores, end_scores = forward(**encoding).to_tuple()
|
20 |
|
21 |
# Let's take the most likely token using `argmax` and retrieve the answer
|
|
|
30 |
question = gr.inputs.Textbox(lines=2, default="Who added BigBird to HuggingFace Transformers?", label="Question")
|
31 |
context = gr.inputs.Textbox(lines=10, default=default_context, label="Context")
|
32 |
|
33 |
+
title = "BigBird-RoBERTa"
|
34 |
+
desc = "BigBird is a transformer based model which can process long sequences (upto 4096) very efficiently. It has shown outstanding results on long document question answering."
|
35 |
+
|
36 |
+
gr.Interface(fn=get_answer, inputs=[question, context], outputs="text", title=title, description=desc).launch()
|