Spaces:
Sleeping
Sleeping
| from fastai.text.all import * | |
| import gradio as gr | |
| from huggingface_hub import from_pretrained_fastai | |
| repo_id = "mahernto/imdbmodel" | |
| learner = from_pretrained_fastai(repo_id) | |
| def predict(text): | |
| pred,pred_idx,probs = learner.predict(text) | |
| if (pred == "0"): | |
| return "Negative" | |
| elif (pred == "1"): | |
| return "Positive" | |
| else: | |
| return "Error" | |
| gr.Interface(fn=predict, inputs=gr.Textbox(lines=4, placeholder="Write your film review..."), outputs="text",examples=["An outstanding film with powerful performances and a moving story. A must-watch.","Terrible acting and a weak script. Not worth watching."]).launch(share=False) |