File size: 605 Bytes
e28289d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr

learn = load_learner('export.pkl')

def reviews_generator(text,n_words):
    preds = lean.predict(text, n_words)
    return outputs

examples = [["The beauty of this books", "45"], ["I didn't like this book because", "30"]]

demo = gr.Interface(fn=reviews_generator, 
                    inputs=[gr.Textbox(lines=2, placeholder="Enter the beginning of the book review here", label="Sample text"), gr.Textbox(lines=1, label="Length of generated text")], 
                    outputs=[gr.Textbox(label="Sample text")], 
                    examples=examples)
demo.launch( debug = True )