Spaces:
Runtime error
Runtime error
Dawid Motyka commited on
Commit ·
24fa0b5
1
Parent(s): f5d4fa9
minor interface changes
Browse files
app.py
CHANGED
|
@@ -45,14 +45,14 @@ pipeline = StancePipeline(model=model, tokenizer=tokenizer, batch_size=1)
|
|
| 45 |
|
| 46 |
def predict(text, target):
|
| 47 |
predictions = pipeline({'text': text, 'target': target})
|
| 48 |
-
return predictions[
|
| 49 |
|
| 50 |
|
| 51 |
gradio_app = gr.Interface(
|
| 52 |
predict,
|
| 53 |
-
inputs=[gr.TextArea(label="Text", placeholder="text"),
|
| 54 |
-
gr.Textbox(label="Target", placeholder="stance target")],
|
| 55 |
-
outputs=[gr.Label(label="Stance
|
| 56 |
title="Polish stance detection",
|
| 57 |
)
|
| 58 |
|
|
|
|
| 45 |
|
| 46 |
def predict(text, target):
|
| 47 |
predictions = pipeline({'text': text, 'target': target})
|
| 48 |
+
return f'{predictions["stance"]} ({predictions["score"]:.3f})'
|
| 49 |
|
| 50 |
|
| 51 |
gradio_app = gr.Interface(
|
| 52 |
predict,
|
| 53 |
+
inputs=[gr.TextArea(label="Text", placeholder="Enter text here..."),
|
| 54 |
+
gr.Textbox(label="Target", placeholder="Enter stance target here...")],
|
| 55 |
+
outputs=[gr.Label(label="Stance class")],
|
| 56 |
title="Polish stance detection",
|
| 57 |
)
|
| 58 |
|