File size: 576 Bytes
5121a37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from inference import model  # Ton modèle préparé dans `inference.py`

def predict_intent(text):
    result = model.predict(text)
    return f"Intent: {result['intent']}\nIs OOS: {result['is_oos']}\nConfidence: {result['confidence']}\nOOS Score: {result['oos_score']:.3f}"

iface = gr.Interface(
    fn=predict_intent,
    inputs=gr.Textbox(lines=2, placeholder="Enter a sentence..."),
    outputs="text",
    title="Intent & OOS Detector",
    description="Type a sentence and get its predicted intent or detect if it's out-of-scope."
)

iface.launch()