Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Connexion à ton modèle personnel
|
| 5 |
+
model_id = "Bader44/Bader44-Scientific-Translator"
|
| 6 |
+
translator = pipeline("translation_en_to_ar", model=model_id)
|
| 7 |
+
|
| 8 |
+
def translate(text):
|
| 9 |
+
# Traduction avec ton IA spécialisée
|
| 10 |
+
result = translator(text, max_length=512)
|
| 11 |
+
return result[0]['translation_text']
|
| 12 |
+
|
| 13 |
+
# Création de l'interface visuelle
|
| 14 |
+
demo = gr.Interface(
|
| 15 |
+
fn=translate,
|
| 16 |
+
inputs=gr.Textbox(label="English Technical Text", lines=5),
|
| 17 |
+
outputs=gr.Textbox(label="Bader44 Arabic Translation", lines=5),
|
| 18 |
+
title="🚀 Bader44 Scientific Translator",
|
| 19 |
+
description="IA entraînée sur les rapports de l'UNCTAD pour une traduction technique précise."
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
demo.launch()
|