rbk1990 commited on
Commit
fa3848c
·
1 Parent(s): 5c68b68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,7 +1,13 @@
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
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)