Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,33 +6,28 @@ 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 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
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 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
# if __name__ == "__main__":
|
27 |
-
# demo.queue().launch(share=True)
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
38 |
-
demo.launch()
|
|
|
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 df(arr):
|
10 |
+
d = {}
|
11 |
+
for val in arr:
|
12 |
+
d[val['token_str']] = val['score']
|
13 |
+
return d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
def fn(text):
|
16 |
+
uzroberta_v1 = pipeline("fill-mask", model="sinonimayzer/UzRoBERTa-v1")
|
17 |
+
roberta_1_8_v2 = pipeline("fill-mask", model="sinonimayzer/roberta-1.8-v2")
|
18 |
+
return df(uzroberta_v1(text)), df(roberta_1_8_v2(text))
|
|
|
|
|
19 |
|
20 |
+
with gr.Blocks() as demo:
|
21 |
+
with gr.Row():
|
22 |
+
with gr.Column():
|
23 |
+
inp = gr.Textbox(label="Input")
|
24 |
+
with gr.Column():
|
25 |
+
output1 = gr.Label(label="UzRoBERTa-v1")
|
26 |
+
output2 = gr.Label(label="roberta-1.8-v2")
|
27 |
+
|
28 |
+
btn = gr.Button("Generate")
|
29 |
+
btn.click(fn, inputs=[inp], outputs=[output1, output2])
|
30 |
+
gr.Examples(examples, inputs=[inp])
|
31 |
|
32 |
+
if __name__ == "__main__":
|
33 |
+
demo.queue().launch(share=True)
|