File size: 944 Bytes
5121a37
d8e1c23
5121a37
 
 
d8e1c23
5121a37
 
 
d8e1c23
5121a37
d8e1c23
 
 
 
 
 
 
 
 
 
 
 
 
 
5121a37
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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()