Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.text.all import *
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
model = load_learner("llmf.pkl")
|
| 5 |
+
def txt_gen(txt, n_words=30, n_sents=2):
|
| 6 |
+
a = [model.predict(txt,n_words,temperature=0.75) for _ in range(n_sents)]
|
| 7 |
+
return "\n".join(a)
|
| 8 |
|
| 9 |
+
sents = gr.components.Textbox()
|
| 10 |
+
outs = gr.components.Textbox()
|
| 11 |
+
examples=["جنگ جهانی دوم رو " ,"شعر و شاعری "]
|
| 12 |
+
intf = gr.Interface(fn=txt_gen, inputs=sents, outputs=outs, examples=examples)
|
| 13 |
+
intf.launch(inline=False)
|