DinoFrog commited on
Commit
a2c7ce8
·
verified ·
1 Parent(s): 1798572

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
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 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
 
@@ -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
- return f"[ERREUR_API]: {e}"
 
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)