Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,8 +15,8 @@ story = open('story.txt').read().replace("\n\n", "\n").replace("\n", " ").strip(
|
|
15 |
|
16 |
def ask(question):
|
17 |
inputs = tokenizer(story, question, truncation=True, padding=True)
|
18 |
-
prediction = torch.softmax(model(**inputs).logits,
|
19 |
-
return {c: prediction[i]
|
20 |
|
21 |
|
22 |
demo = gr.Interface(
|
@@ -27,7 +27,7 @@ demo = gr.Interface(
|
|
27 |
description="“ Albert and Dave find themselves on the pier. They go to a nearby restaurant where Albert orders "
|
28 |
"seagull meat. The waiter promptly serves Albert the meal. After taking a bite, he realizes "
|
29 |
"something. Albert pulls a gun out of his ruined jacket and shoots himself. ”\n\nWhy did Albert shoot "
|
30 |
-
"himself?\n\nCan you unravel the truth behind this epilogue by asking only yes/no questions
|
31 |
article='Please refrain from embarrassing DeBERTa with dumb questions.\n\nCheck the repository for more detail: https://github.com/MrPio/The-Seagull-Story',
|
32 |
examples=['Albert shoot himself for a reason',
|
33 |
'Dave has a watch on his wrist',
|
|
|
15 |
|
16 |
def ask(question):
|
17 |
inputs = tokenizer(story, question, truncation=True, padding=True)
|
18 |
+
prediction = np.round(torch.softmax(model(**inputs).logits, 1).squeeze().numpy(), 3)
|
19 |
+
return {c: prediction[i] for c, i in CLASSES}
|
20 |
|
21 |
|
22 |
demo = gr.Interface(
|
|
|
27 |
description="“ Albert and Dave find themselves on the pier. They go to a nearby restaurant where Albert orders "
|
28 |
"seagull meat. The waiter promptly serves Albert the meal. After taking a bite, he realizes "
|
29 |
"something. Albert pulls a gun out of his ruined jacket and shoots himself. ”\n\nWhy did Albert shoot "
|
30 |
+
"himself?\n\nCan you unravel the truth behind this epilogue by asking only yes/no questions?\n\nPlease be specific about the time period you have in mind with your question.",
|
31 |
article='Please refrain from embarrassing DeBERTa with dumb questions.\n\nCheck the repository for more detail: https://github.com/MrPio/The-Seagull-Story',
|
32 |
examples=['Albert shoot himself for a reason',
|
33 |
'Dave has a watch on his wrist',
|