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 =
|
19 |
-
return {c: prediction[i] for c, i in CLASSES}
|
20 |
|
21 |
|
22 |
demo = gr.Interface(
|
|
|
15 |
|
16 |
def ask(question):
|
17 |
inputs = tokenizer(story, question, truncation=True, padding=True)
|
18 |
+
prediction = torch.round(torch.softmax(model(**inputs).logits, 1).squeeze().numpy(), 3)
|
19 |
+
return {c: prediction[i].item() for c, i in CLASSES}
|
20 |
|
21 |
|
22 |
demo = gr.Interface(
|