Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from inference import model | |
| def predict_intent(text): | |
| result = model.predict(text) | |
| return f"Intent: {result['intent']}\nConfidence: {result['confidence']}\nOOS Score: {result['oos_score']:.3f}" | |
| iface = gr.Interface( | |
| fn=predict_intent, | |
| inputs=gr.Textbox(lines=2, placeholder="Enter a sentence...", value="Do you know Roger?"), | |
| outputs="text", | |
| title="Intent Classifier & OOS Detector", | |
| description=""" | |
| <span style="font-size: 18px;">Type a sentence and get its predicted intent or detect if it's out-of-scope.</span> | |
| Supported intents include (not exhaustive): `weather`, `translate`, `play_music`,... | |
| The output will include: | |
| - The predicted intent (or `"oos"` if out-of-scope), | |
| - The confidence score of the predicted intent (or `None` if out-of-scope), | |
| - The OOS score (higher = more likely to be out-of-scope). | |
| 🇬🇧 This model was trained on English-only data. | |
| """ | |
| ) | |
| iface.launch() |