Spaces:
Runtime error
Runtime error
admchiem
commited on
Commit
·
4eb331b
1
Parent(s):
4cf0c27
Ajout de app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from inference import model # Ton modèle préparé dans `inference.py`
|
3 |
+
|
4 |
+
def predict_intent(text):
|
5 |
+
result = model.predict(text)
|
6 |
+
return f"Intent: {result['intent']}\nIs OOS: {result['is_oos']}\nConfidence: {result['confidence']}\nOOS Score: {result['oos_score']:.3f}"
|
7 |
+
|
8 |
+
iface = gr.Interface(
|
9 |
+
fn=predict_intent,
|
10 |
+
inputs=gr.Textbox(lines=2, placeholder="Enter a sentence..."),
|
11 |
+
outputs="text",
|
12 |
+
title="Intent & OOS Detector",
|
13 |
+
description="Type a sentence and get its predicted intent or detect if it's out-of-scope."
|
14 |
+
)
|
15 |
+
|
16 |
+
iface.launch()
|