haouarin's picture
Update app.py
70fe0b3
raw
history blame
533 Bytes
import gradio as gr
gr.Interface.load("models/alger-ia/dziribert").launch()
def predict(text):
return pipe(text)[0]["translation_text"]
generated_text_set = set()
for i in range(50):
result = fill_mask(text)
r = result[random.randint(0, 4)]["sequence"]
if r not in generated_text_set:
print(r)
text = r + " [MASK]"
generated_text_set.add(r)
else:
continue
iface = gr.Interface(
fn=predict,
inputs='text',
outputs='text',
examples=[["أنا [MASK]"]]
)
iface.launch()