Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,10 +15,11 @@ def call_mistral_api(prompt, hf_token=HF_TOKEN):
|
|
15 |
API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2"
|
16 |
headers = {"Authorization": f"Bearer {hf_token}"}
|
17 |
payload = {"inputs": prompt, "parameters": {"max_new_tokens": 300}}
|
18 |
-
response = requests.post(API_URL, headers=headers, json=payload)
|
19 |
response.raise_for_status()
|
20 |
return response.json()[0]["generated_text"]
|
21 |
|
|
|
22 |
# Chargement du modèle de sentiment
|
23 |
classifier = pipeline("sentiment-analysis", model="mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis")
|
24 |
|
|
|
15 |
API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2"
|
16 |
headers = {"Authorization": f"Bearer {hf_token}"}
|
17 |
payload = {"inputs": prompt, "parameters": {"max_new_tokens": 300}}
|
18 |
+
response = requests.post(API_URL, headers=headers, json=payload, timeout=60)
|
19 |
response.raise_for_status()
|
20 |
return response.json()[0]["generated_text"]
|
21 |
|
22 |
+
|
23 |
# Chargement du modèle de sentiment
|
24 |
classifier = pipeline("sentiment-analysis", model="mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis")
|
25 |
|