Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,52 +1,119 @@
|
|
| 1 |
import gradio as gr
|
| 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 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
do_sample=True,
|
| 37 |
-
temperature=0.7,
|
| 38 |
-
top_p=0.9,
|
| 39 |
-
)
|
| 40 |
|
| 41 |
-
return
|
| 42 |
|
| 43 |
-
# Interface Gradio
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def generate_description(prompt, max_tokens=200, temperature=0.7):
|
| 4 |
+
"""
|
| 5 |
+
Fonction temporaire en attendant que DeepSeek V3.2 soit supporté
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
# Message d'information
|
| 9 |
+
info_message = f"""
|
| 10 |
+
⚠️ **Modèle en attente de support**
|
| 11 |
+
|
| 12 |
+
Le modèle **witflag/HelixaV2** utilise l'architecture DeepSeek V3.2 qui n'est pas encore supportée par HuggingFace Spaces.
|
| 13 |
+
|
| 14 |
+
📝 **Votre requête :**
|
| 15 |
+
```
|
| 16 |
+
{prompt}
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
💡 **Solutions alternatives :**
|
| 20 |
+
|
| 21 |
+
1. **Utiliser l'API localement** (Google Colab, Kaggle)
|
| 22 |
+
2. **Créer un Inference Endpoint** (payant mais fonctionne)
|
| 23 |
+
3. **Attendre le support officiel** de DeepSeek V3.2 (~quelques semaines)
|
| 24 |
+
|
| 25 |
+
🔗 **Modèle :** [witflag/HelixaV2](https://huggingface.co/witflag/HelixaV2)
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
**Exemple de sortie attendue :**
|
| 30 |
+
```arabic
|
| 31 |
+
هاتف سامسونج جالاكسي اس 24 الترا يأتي بمعالج سنابدراجون 8 جين 3 القوي،
|
| 32 |
+
مع كاميرا رئيسية بدقة 200 ميجابكسل وبطارية ضخمة بسعة 5000 مللي أمبير.
|
| 33 |
+
يوفر الهاتف أداءً استثنائياً للألعاب والتصوير الاحترافي...
|
| 34 |
+
```
|
| 35 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
return info_message
|
| 38 |
|
| 39 |
+
# Interface Gradio
|
| 40 |
+
with gr.Blocks(
|
| 41 |
+
title="HelixaV2 API - En développement",
|
| 42 |
+
theme=gr.themes.Soft()
|
| 43 |
+
) as demo:
|
| 44 |
+
|
| 45 |
+
gr.Markdown("""
|
| 46 |
+
# 📱 HelixaV2 API - Générateur de descriptions smartphones en arabe
|
| 47 |
+
|
| 48 |
+
⚠️ **Status :** En attente de support DeepSeek V3.2 par HuggingFace
|
| 49 |
+
|
| 50 |
+
Ce Space est en cours de développement. Le modèle sera disponible dès que l'architecture DeepSeek V3.2 sera supportée.
|
| 51 |
+
""")
|
| 52 |
+
|
| 53 |
+
with gr.Row():
|
| 54 |
+
with gr.Column():
|
| 55 |
+
input_text = gr.Textbox(
|
| 56 |
+
label="📝 Fiche technique (specs)",
|
| 57 |
+
placeholder="Ex: Samsung Galaxy S24 Ultra, Snapdragon 8 Gen 3, 200MP camera, 5000mAh",
|
| 58 |
+
lines=3
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
with gr.Row():
|
| 62 |
+
max_tokens = gr.Slider(
|
| 63 |
+
minimum=50,
|
| 64 |
+
maximum=500,
|
| 65 |
+
value=200,
|
| 66 |
+
step=10,
|
| 67 |
+
label="🔢 Longueur maximale"
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
temperature = gr.Slider(
|
| 71 |
+
minimum=0.1,
|
| 72 |
+
maximum=1.5,
|
| 73 |
+
value=0.7,
|
| 74 |
+
step=0.1,
|
| 75 |
+
label="🌡️ Température"
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
generate_btn = gr.Button("📋 Voir les infos", variant="primary")
|
| 79 |
+
|
| 80 |
+
with gr.Column():
|
| 81 |
+
output_text = gr.Textbox(
|
| 82 |
+
label="ℹ️ Informations",
|
| 83 |
+
lines=15
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
# Exemples
|
| 87 |
+
gr.Examples(
|
| 88 |
+
examples=[
|
| 89 |
+
["Samsung Galaxy S24 Ultra, Snapdragon 8 Gen 3, 200MP camera, 5000mAh"],
|
| 90 |
+
["iPhone 15 Pro Max, A17 Pro chip, 48MP camera, 4422mAh battery"],
|
| 91 |
+
["OnePlus 12, Snapdragon 8 Gen 3, 50MP camera, 5400mAh"]
|
| 92 |
+
],
|
| 93 |
+
inputs=input_text
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
gr.Markdown("""
|
| 97 |
+
---
|
| 98 |
+
|
| 99 |
+
### 🔗 Ressources
|
| 100 |
+
|
| 101 |
+
- **Modèle :** [witflag/HelixaV2](https://huggingface.co/witflag/HelixaV2)
|
| 102 |
+
- **Architecture :** DeepSeek V3.2
|
| 103 |
+
- **Contact :** [@witflag](https://huggingface.co/witflag)
|
| 104 |
+
|
| 105 |
+
### 📊 Alternatives disponibles maintenant
|
| 106 |
+
|
| 107 |
+
1. **Utiliser sur Google Colab** : [Guide d'installation]
|
| 108 |
+
2. **API Inference Endpoint** : Configuration payante mais fonctionnelle
|
| 109 |
+
3. **Modèles alternatifs** : AraGPT2, Gemma-2-Arabic, etc.
|
| 110 |
+
""")
|
| 111 |
+
|
| 112 |
+
# Événement
|
| 113 |
+
generate_btn.click(
|
| 114 |
+
fn=generate_description,
|
| 115 |
+
inputs=[input_text, max_tokens, temperature],
|
| 116 |
+
outputs=output_text
|
| 117 |
+
)
|
| 118 |
|
| 119 |
+
demo.launch()
|
|
|