Spaces:
Runtime error
Runtime error
File size: 724 Bytes
e28289d 0dccf94 e28289d 1fc4cca e28289d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
import fastbook
from fastbook import *
from pathlib import Path
from fastai.text.all import *
fastbook.setup_book()
learn = load_learner('export.pkl')
def reviews_generator(text,n_words):
preds = learn.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 ) |