Ajouter le script Gradio et les dépendances*
Browse files
app.py
CHANGED
|
@@ -2,19 +2,17 @@ import os
|
|
| 2 |
import gradio as gr
|
| 3 |
from qdrant_client import QdrantClient
|
| 4 |
from transformers import ClapModel, ClapProcessor
|
| 5 |
-
from huggingface_hub import
|
| 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
|
| 18 |
|
| 19 |
client = QdrantClient(qdrant_url, qdrant_key)
|
| 20 |
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from qdrant_client import QdrantClient
|
| 4 |
from transformers import ClapModel, ClapProcessor
|
| 5 |
+
from huggingface_hub import HfApi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
# Utilisation de Hugging Face Hub API pour récupérer les secrets
|
| 8 |
+
api = HfApi()
|
| 9 |
+
secrets = api.repository_config("leadr64/audi_data") # Remplacez par votre nom d'utilisateur et nom du repository
|
| 10 |
|
| 11 |
+
qdrant_url = secrets.get("QDRANT_URL")
|
| 12 |
+
qdrant_key = secrets.get("QDRANT_KEY")
|
| 13 |
|
| 14 |
if not qdrant_url or not qdrant_key:
|
| 15 |
+
raise ValueError("QDRANT_URL and QDRANT_KEY must be set as secrets in your Hugging Face repository.")
|
| 16 |
|
| 17 |
client = QdrantClient(qdrant_url, qdrant_key)
|
| 18 |
|