Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,25 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
gr.Interface.load("models/alger-ia/dziribert").launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
gr.Interface.load("models/alger-ia/dziribert").launch()
|
4 |
+
|
5 |
+
def predict(text):
|
6 |
+
return pipe(text)[0]["translation_text"]
|
7 |
+
generated_text_set = set()
|
8 |
+
for i in range(50):
|
9 |
+
result = fill_mask(text)
|
10 |
+
r = result[random.randint(0, 4)]["sequence"]
|
11 |
+
if r not in generated_text_set:
|
12 |
+
print(r)
|
13 |
+
text = r + " [MASK]"
|
14 |
+
generated_text_set.add(r)
|
15 |
+
else:
|
16 |
+
continue
|
17 |
+
|
18 |
+
iface = gr.Interface(
|
19 |
+
fn=predict,
|
20 |
+
inputs='text',
|
21 |
+
outputs='text',
|
22 |
+
examples=[["أنا [MASK]"]]
|
23 |
+
)
|
24 |
+
|
25 |
+
iface.launch()
|