Spaces:
Runtime error
Runtime error
| from huggingface_hub import from_pretrained_fastai | |
| import gradio as gr | |
| from fastai.vision.all import * | |
| # repo_id = "YOUR_USERNAME/YOUR_LEARNER_NAME" | |
| repo_id = "isboudja/Spam" | |
| learner = from_pretrained_fastai(repo_id) | |
| labels = learner.dls.vocab | |
| def predict(text): | |
| pred, pred_idx, probs = learner.predict(text) | |
| if pred == '1': | |
| return "Spam" | |
| else: | |
| return "Not Spam" | |
| # Create and launch the Gradio interface for text input | |
| gr.Interface( | |
| fn=predict, | |
| inputs=gr.inputs.Textbox(), | |
| outputs=gr.outputs.Label(), | |
| examples=["WON a guaranteed £1000 cash","Hello, how are you?"] | |
| ).launch(share=False) |