Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,6 @@ classifier = pipeline("text-classification", tokenizer=tokenizer, model=model, m
|
|
17 |
padding=True, truncation=True, batch_size=1)
|
18 |
|
19 |
def prozesatu(Testua, request: gr.Request):
|
20 |
-
return str(request.headers["accept-language"])
|
21 |
prediction = prozesatu.classifier(Testua)[0]
|
22 |
if prediction["label"]=="GAI":
|
23 |
return {"Gai":prediction["score"], "Ez gai": 1-prediction["score"]}
|
@@ -27,12 +26,20 @@ def prozesatu(Testua, request: gr.Request):
|
|
27 |
|
28 |
prozesatu.classifier = classifier
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
padding=True, truncation=True, batch_size=1)
|
18 |
|
19 |
def prozesatu(Testua, request: gr.Request):
|
|
|
20 |
prediction = prozesatu.classifier(Testua)[0]
|
21 |
if prediction["label"]=="GAI":
|
22 |
return {"Gai":prediction["score"], "Ez gai": 1-prediction["score"]}
|
|
|
26 |
|
27 |
prozesatu.classifier = classifier
|
28 |
|
29 |
+
def ezabatu(Testua):
|
30 |
+
return ""
|
31 |
+
|
32 |
+
with gr.Blocks() as demo:
|
33 |
+
with gr.Row():
|
34 |
+
with gr.Column():
|
35 |
+
input = gr.Textbox(label="Testua")
|
36 |
+
with gr.Row():
|
37 |
+
bidali_btn = gr.Button("Bidali")
|
38 |
+
ezabatu_btn = gr.Button("Ezabatu")
|
39 |
+
|
40 |
+
label = gr.Label(num_top_classes=2, label="C1 maila")
|
41 |
+
|
42 |
+
|
43 |
+
bidali_btn.click(fn=prozesatu, inputs=input, outputs=label)
|
44 |
+
ezabatu_btn.click(fn=ezabatu, inputs=input, outputs=input)
|
45 |
+
demo.launch()
|