UzRoBERTa / app.py
Mansurbek's picture
Update app.py
ef3e238
raw
history blame
No virus
1 kB
import gradio as gr
examples = [
'Kuchli yomg‘irlar tufayli bir qator <mask> kuchli sel oqishi kuzatildi.',
'Shu munosabat bilan O‘zbekiston Prezidenti global inqiroz sharoitida savdo-iqtisodiy hamkorlikni <mask> va hududlararo aloqalarni rivojlantirishning muhim masalalariga to‘xtalib o‘tdi.',
]
def fn(text):
uzroberta_v1 = pipeline("fill-mask", model="sinonimayzer/UzRoBERTa-v1")
roberta_1_8_v2 = pipeline("fill-mask", model="sinonimayzer/roberta-1.8-v2")
return [
uzroberta_v1(text),
roberta_1_8_v2(text)
]
demo = gr.load(
fn,
inputs=gr.Textbox(lines=5, max_lines=6, label="Input"),
outputs=[gr.Label(label="UzRoBERTa-v1"), gr.Label(label="roberta-1.8-v2")],
examples=examples,
src="models",
)
# with gr.Blocks() as demo:
# with gr.Tab("UzRoBERTa-v1"):
# gr.load("sinonimayzer/UzRoBERTa-v1", src="models")
# with gr.Tab("roberta-1.8-v2"):
# gr.load("sinonimayzer/roberta-1.8-v2", src="models")
# demo.launch()