Mansurbek commited on
Commit
1cf8b14
·
1 Parent(s): 48da952

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -3
app.py CHANGED
@@ -1,5 +1,27 @@
1
- import gradio as gr
2
 
3
- demo = gr.load("sinonimayzer/UzRoBERTa-v1", src="models")
 
 
4
 
5
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mport gradio as gr
2
 
3
+ examples = [
4
+ ['The goal of life is <mask>.','']
5
+ ]
6
 
7
+ uzroberta_v1 = gr.Interface.load("sinonimayzer/UzRoBERTa-v1")
8
+ roberta_1_8_v2 = gr.Interface.load("sinonimayzer/roberta-1.8-v2")
9
+
10
+
11
+ def inference(input, model):
12
+ if model == "UzRoBERTa-v1":
13
+ result = uzroberta_v1(input)
14
+ else:
15
+ result = roberta_1_8_v2(input)
16
+ return result
17
+
18
+ gr.Interface(
19
+ inference,
20
+ [
21
+ gr.inputs.Textbox(label="Context", lines=10),
22
+ gr.inputs.Dropdown(choices=["UzRoBERTa-v1","roberta-1.8-v2"], type="value", default="UzRoBERTa-v1", label="model")
23
+ ],
24
+ [
25
+ gr.outputs.Label(label="Output")
26
+ ],
27
+ examples=examples).launch(enable_queue=True)