EkhiAzur commited on
Commit
27001e3
1 Parent(s): 3237200

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -28,6 +28,12 @@ def prozesatu(Testua, request: gr.Request):
28
  else:
29
  return {"Gai":1-prediction["score"], "Ez gai": prediction["score"]}
30
 
 
 
 
 
 
 
31
  prozesatu.adibideak = adibideak
32
  prozesatu.classifier = classifier
33
 
@@ -44,9 +50,9 @@ with gr.Blocks() as demo:
44
 
45
  label = gr.Label(num_top_classes=2, label="C1 maila")
46
 
47
-
48
  bidali_btn.click(fn=prozesatu, inputs=input, outputs=label)
49
  ezabatu_btn.click(fn=ezabatu, inputs=input, outputs=input)
50
- gr.Examples(list(adibideak.keys()), inputs=input, outputs=label, label="Adibideak:", fn=prozesatu, cache_examples=True)
 
51
 
52
  demo.launch()
 
28
  else:
29
  return {"Gai":1-prediction["score"], "Ez gai": prediction["score"]}
30
 
31
+ def testua_itzuli(testua):
32
+ if testua not in testua_itzuli.adibideak:
33
+ return ""
34
+ return testua_itzuli.adibideak[testua]
35
+
36
+ testua_itzuli.adibideak = adibideak
37
  prozesatu.adibideak = adibideak
38
  prozesatu.classifier = classifier
39
 
 
50
 
51
  label = gr.Label(num_top_classes=2, label="C1 maila")
52
 
 
53
  bidali_btn.click(fn=prozesatu, inputs=input, outputs=label)
54
  ezabatu_btn.click(fn=ezabatu, inputs=input, outputs=input)
55
+
56
+ gr.Examples(list(adibideak.keys()), inputs=input, outputs=input, label="Adibideak:", fn=testua_itzuli, cache_examples=True)
57
 
58
  demo.launch()