Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,10 +17,17 @@ classifier = pipeline("text-classification", tokenizer=tokenizer, model=model, m
|
|
17 |
padding=True, truncation=True, batch_size=1)
|
18 |
|
19 |
def prozesatu(testua):
|
20 |
-
|
21 |
prediction = prozesatu.classifier(testua)[0]
|
22 |
-
return
|
|
|
23 |
|
24 |
prozesatu.classifier = classifier
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
padding=True, truncation=True, batch_size=1)
|
18 |
|
19 |
def prozesatu(testua):
|
|
|
20 |
prediction = prozesatu.classifier(testua)[0]
|
21 |
+
return {"Gai":prediction["score"], "Ez gai": 1-prediction["score"]}
|
22 |
+
#return 'C1:{}. Probabilitatea:{:.2f}'.format(prediction["label"], round(prediction["score"], 2))
|
23 |
|
24 |
prozesatu.classifier = classifier
|
25 |
|
26 |
+
demo = gr.Interface(
|
27 |
+
fn=prozesatu,
|
28 |
+
inputs=gr.Textbox(placeholder="Idatzi hemen testua..."),
|
29 |
+
outputs="label",
|
30 |
+
interpretation="default",
|
31 |
+
examples=[["Gaur egungo teknologiak bikainak dira..."]]).launch()
|
32 |
+
|
33 |
+
#gr.Interface(fn=prozesatu, inputs="text", outputs="text").launch()
|