Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,10 @@ def call_zephyr_api(prompt, hf_token=HF_TOKEN):
|
|
19 |
response.raise_for_status()
|
20 |
return response.json()[0]["generated_text"]
|
21 |
except Exception as e:
|
22 |
-
|
|
|
|
|
|
|
23 |
|
24 |
# Chargement du modèle de sentiment
|
25 |
classifier = pipeline("sentiment-analysis", model="mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis")
|
|
|
19 |
response.raise_for_status()
|
20 |
return response.json()[0]["generated_text"]
|
21 |
except Exception as e:
|
22 |
+
error_msg = f"❌ Erreur d'appel API Hugging Face : {str(e)}"
|
23 |
+
if isinstance(e, requests.exceptions.RequestException):
|
24 |
+
error_msg += f" (Code de statut : {e.response.status_code if e.response else 'N/A'})"
|
25 |
+
raise gr.Error(error_msg)
|
26 |
|
27 |
# Chargement du modèle de sentiment
|
28 |
classifier = pipeline("sentiment-analysis", model="mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis")
|