Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,8 +11,8 @@ HF_TOKEN = os.getenv("HF_TOKEN")
|
|
11 |
|
12 |
|
13 |
# Fonction pour appeler l'API Mistral-7B
|
14 |
-
def
|
15 |
-
API_URL = "https://api-inference.huggingface.co/models/
|
16 |
headers = {"Authorization": f"Bearer {hf_token}"}
|
17 |
payload = {"inputs": prompt, "parameters": {"max_new_tokens": 300}}
|
18 |
|
@@ -21,7 +21,8 @@ def call_mistral_api(prompt, hf_token=HF_TOKEN):
|
|
21 |
response.raise_for_status()
|
22 |
return response.json()[0]["generated_text"]
|
23 |
except Exception as e:
|
24 |
-
|
|
|
25 |
|
26 |
|
27 |
|
@@ -112,6 +113,13 @@ def launch_app():
|
|
112 |
with gr.Blocks(theme=gr.themes.Base(), css="body {background-color: #0D1117; color: white;} .gr-button {background-color: #161B22; border: 1px solid #30363D;}") as iface:
|
113 |
|
114 |
gr.Markdown("# 📈 Analyse Financière Premium + Explication IA", elem_id="title")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
gr.Markdown("Entrez une actualité financière. L'IA analyse et explique en anglais/français. Choisissez votre mode d'explication.")
|
116 |
|
117 |
count = gr.State(0)
|
|
|
11 |
|
12 |
|
13 |
# Fonction pour appeler l'API Mistral-7B
|
14 |
+
def call_zephyr_api(prompt, hf_token=HF_TOKEN):
|
15 |
+
API_URL = "https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta"
|
16 |
headers = {"Authorization": f"Bearer {hf_token}"}
|
17 |
payload = {"inputs": prompt, "parameters": {"max_new_tokens": 300}}
|
18 |
|
|
|
21 |
response.raise_for_status()
|
22 |
return response.json()[0]["generated_text"]
|
23 |
except Exception as e:
|
24 |
+
raise gr.Error(f"❌ Erreur d'appel API Hugging Face : {str(e)}")
|
25 |
+
|
26 |
|
27 |
|
28 |
|
|
|
113 |
with gr.Blocks(theme=gr.themes.Base(), css="body {background-color: #0D1117; color: white;} .gr-button {background-color: #161B22; border: 1px solid #30363D;}") as iface:
|
114 |
|
115 |
gr.Markdown("# 📈 Analyse Financière Premium + Explication IA", elem_id="title")
|
116 |
+
gr.Markdown(
|
117 |
+
"<div style='background-color: #161B22; padding: 10px; border-radius: 8px; text-align: center;'>"
|
118 |
+
"<strong>🧠 Powered by Zephyr-7B-Beta</strong>"
|
119 |
+
"</div>",
|
120 |
+
unsafe_allow_html=True
|
121 |
+
)
|
122 |
+
|
123 |
gr.Markdown("Entrez une actualité financière. L'IA analyse et explique en anglais/français. Choisissez votre mode d'explication.")
|
124 |
|
125 |
count = gr.State(0)
|