Mansurbek commited on
Commit
36fa644
1 Parent(s): bf2ec42

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -16
app.py CHANGED
@@ -6,22 +6,33 @@ examples = [
6
  'Shu munosabat bilan O‘zbekiston Prezidenti global inqiroz sharoitida savdo-iqtisodiy hamkorlikni <mask> va hududlararo aloqalarni rivojlantirishning muhim masalalariga to‘xtalib o‘tdi.',
7
  ]
8
 
9
- def fn(text):
10
- uzroberta_v1 = pipeline("fill-mask", model="sinonimayzer/UzRoBERTa-v1")
11
- roberta_1_8_v2 = pipeline("fill-mask", model="sinonimayzer/roberta-1.8-v2")
12
- return uzroberta_v1(text), roberta_1_8_v2(text)
13
 
14
- with gr.Blocks() as demo:
15
- with gr.Row():
16
- with gr.Column():
17
- inp = gr.Textbox(label="Input")
18
- with gr.Column():
19
- output1 = gr.Label(label="UzRoBERTa-v1")
20
- output2 = gr.Label(label="roberta-1.8-v2")
21
 
22
- btn = gr.Button("Generate")
23
- btn.click(fn, inputs=[inp], outputs=[output1, output2])
24
- gr.Examples(examples, inputs=[inp])
25
 
26
- if __name__ == "__main__":
27
- demo.queue().launch(share=True)
 
 
 
 
 
 
 
 
 
 
 
 
6
  'Shu munosabat bilan O‘zbekiston Prezidenti global inqiroz sharoitida savdo-iqtisodiy hamkorlikni <mask> va hududlararo aloqalarni rivojlantirishning muhim masalalariga to‘xtalib o‘tdi.',
7
  ]
8
 
9
+ # def fn(text):
10
+ # uzroberta_v1 = pipeline("fill-mask", model="sinonimayzer/UzRoBERTa-v1")
11
+ # roberta_1_8_v2 = pipeline("fill-mask", model="sinonimayzer/roberta-1.8-v2")
12
+ # return uzroberta_v1(text), roberta_1_8_v2(text)
13
 
14
+ # with gr.Blocks() as demo:
15
+ # with gr.Row():
16
+ # with gr.Column():
17
+ # inp = gr.Textbox(label="Input")
18
+ # with gr.Column():
19
+ # output1 = gr.Label(label="UzRoBERTa-v1")
20
+ # output2 = gr.Label(label="roberta-1.8-v2")
21
 
22
+ # btn = gr.Button("Generate")
23
+ # btn.click(fn, inputs=[inp], outputs=[output1, output2])
24
+ # gr.Examples(examples, inputs=[inp])
25
 
26
+ # if __name__ == "__main__":
27
+ # demo.queue().launch(share=True)
28
+
29
+ m1 = gr.load("sinonimayzer/UzRoBERTa-v1", src="models")
30
+ m2 = gr.load("sinonimayzer/roberta-1.8-v2", src="models")
31
+
32
+ def combine_models(input_text):
33
+ output1 = m1.predict(input_text)
34
+ output2 = m2.predict(input_text)
35
+ return {"Model 1 Output": output1, "Model 2 Output": output2}
36
+
37
+ demo = gr.Interface(fn=combine_models, inputs="text", outputs=["label", "label"])
38
+ demo.launch()