Mansurbek commited on
Commit
9adf938
1 Parent(s): d582d22

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -10,6 +10,12 @@ examples = [
10
  'Venera - Quyosh tizimidagi o‘z o‘qi atrofida soat sohasi farqli ravishda aylanadigan yagona <mask>.'
11
  ]
12
 
 
 
 
 
 
 
13
  def df(arr):
14
  d = {}
15
  for val in arr:
@@ -17,9 +23,8 @@ def df(arr):
17
  return d
18
 
19
  def fn(text):
20
- uzroberta_v1 = pipeline("fill-mask", model="sinonimayzer/UzRoBERTa-v1")
21
- roberta_1_8_v2 = pipeline("fill-mask", model="sinonimayzer/roberta-1.8-v2")
22
- roberta_1_0 = pipeline("fill-mask", model="sinonimayzer/roberta-1.0")
23
  return df(uzroberta_v1(text)), df(roberta_1_8_v2(text)), df(roberta_1_0(text))
24
 
25
  with gr.Blocks() as demo:
@@ -32,7 +37,7 @@ with gr.Blocks() as demo:
32
  output3 = gr.Label(label="roberta-1.0")
33
  btn = gr.Button("Check")
34
  btn.click(fn, inputs=[inp], outputs=[output1, output2, output3])
35
- gr.Examples(examples, fn=fn, inputs=[inp], cache_examples=True, batch=True)
36
 
37
  if __name__ == "__main__":
38
  demo.queue().launch()
 
10
  'Venera - Quyosh tizimidagi o‘z o‘qi atrofida soat sohasi farqli ravishda aylanadigan yagona <mask>.'
11
  ]
12
 
13
+ models = [
14
+ "sinonimayzer/UzRoBERTa-v1",
15
+ "sinonimayzer/roberta-1.8-v2",
16
+ "sinonimayzer/roberta-1.0"
17
+ ]
18
+
19
  def df(arr):
20
  d = {}
21
  for val in arr:
 
23
  return d
24
 
25
  def fn(text):
26
+ for model in models:
27
+ yield pipeline("fill-mask", model=model)
 
28
  return df(uzroberta_v1(text)), df(roberta_1_8_v2(text)), df(roberta_1_0(text))
29
 
30
  with gr.Blocks() as demo:
 
37
  output3 = gr.Label(label="roberta-1.0")
38
  btn = gr.Button("Check")
39
  btn.click(fn, inputs=[inp], outputs=[output1, output2, output3])
40
+ gr.Examples(examples, fn=fn, inputs=[inp], outputs=[output1, output2, output3], cache_examples=True, batch=True)
41
 
42
  if __name__ == "__main__":
43
  demo.queue().launch()