Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Charge ton modèle NorBERT depuis le hub
|
| 5 |
+
clf = pipeline("text-classification", model="jeromex1/NorBERT_Chti")
|
| 6 |
+
|
| 7 |
+
def predict(text):
|
| 8 |
+
return clf(text)
|
| 9 |
+
|
| 10 |
+
# Interface utilisateur web
|
| 11 |
+
demo = gr.Interface(
|
| 12 |
+
fn=predict,
|
| 13 |
+
inputs=gr.Textbox(lines=2, placeholder="Écris une phrase en Chti..."),
|
| 14 |
+
outputs="label",
|
| 15 |
+
title="NorBERT – Analyse de sentiments en Chti",
|
| 16 |
+
description="Fine-tuning de CamemBERT pour la classification (positif / neutre / négatif)."
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
demo.launch()
|