Spaces:
Sleeping
Sleeping
Update rag_utils.py
Browse files- rag_utils.py +1 -6
rag_utils.py
CHANGED
@@ -27,7 +27,7 @@ def nettoyer_context(context):
|
|
27 |
import os
|
28 |
from huggingface_hub import InferenceClient
|
29 |
|
30 |
-
client = InferenceClient("tiiuae/falcon-7b-instruct"
|
31 |
|
32 |
def generate_answer(question, context):
|
33 |
prompt = f"""Voici des informations sur des établissements et formations :
|
@@ -38,14 +38,9 @@ Formule ta réponse comme un conseiller d’orientation bienveillant, de manièr
|
|
38 |
|
39 |
Question : {question}
|
40 |
Réponse :"""
|
41 |
-
|
42 |
-
try:
|
43 |
print("===== PROMPT ENVOYÉ =====")
|
44 |
print(prompt)
|
45 |
response = client.text_generation(prompt, max_new_tokens=300, timeout=30)
|
46 |
print("===== RÉPONSE REÇUE =====")
|
47 |
print(response)
|
48 |
return response
|
49 |
-
except Exception as e:
|
50 |
-
print("Erreur Hugging Face API :", e)
|
51 |
-
return "😓 Le conseiller IA est temporairement indisponible. Merci de réessayer plus tard."
|
|
|
27 |
import os
|
28 |
from huggingface_hub import InferenceClient
|
29 |
|
30 |
+
client = InferenceClient("tiiuae/falcon-7b-instruct")
|
31 |
|
32 |
def generate_answer(question, context):
|
33 |
prompt = f"""Voici des informations sur des établissements et formations :
|
|
|
38 |
|
39 |
Question : {question}
|
40 |
Réponse :"""
|
|
|
|
|
41 |
print("===== PROMPT ENVOYÉ =====")
|
42 |
print(prompt)
|
43 |
response = client.text_generation(prompt, max_new_tokens=300, timeout=30)
|
44 |
print("===== RÉPONSE REÇUE =====")
|
45 |
print(response)
|
46 |
return response
|
|
|
|
|
|