Ajouter le script Gradio et les dépendances*
Browse files
app.py
CHANGED
|
@@ -2,10 +2,16 @@ import os
|
|
| 2 |
import gradio as gr
|
| 3 |
from qdrant_client import QdrantClient
|
| 4 |
from transformers import ClapModel, ClapProcessor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
# Utiliser les secrets définis comme variables d'environnement
|
| 7 |
-
qdrant_url = os.getenv("QDRANT_URL")
|
| 8 |
-
qdrant_key = os.getenv("QDRANT_KEY")
|
| 9 |
|
| 10 |
if not qdrant_url or not qdrant_key:
|
| 11 |
raise ValueError("QDRANT_URL and QDRANT_KEY must be set as environment variables.")
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from qdrant_client import QdrantClient
|
| 4 |
from transformers import ClapModel, ClapProcessor
|
| 5 |
+
from huggingface_hub import Repository
|
| 6 |
+
|
| 7 |
+
# Récupérer le référentiel (repository) de votre espace Hugging Face
|
| 8 |
+
repo = Repository()
|
| 9 |
+
|
| 10 |
+
# Récupérer les secrets à partir des paramètres secrets
|
| 11 |
+
qdrant_url = repo.config.get("QDRANT_URL")
|
| 12 |
+
qdrant_key = repo.config.get("QDRANT_KEY")
|
| 13 |
+
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
if not qdrant_url or not qdrant_key:
|
| 17 |
raise ValueError("QDRANT_URL and QDRANT_KEY must be set as environment variables.")
|