Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,8 +49,10 @@ index = faiss.read_index(doc_path)
|
|
49 |
if not index:
|
50 |
print("Problème index")
|
51 |
|
52 |
-
def qa(question
|
53 |
"""Fonction principale pour répondre à la question en utilisant RAG avec jusqu'à 5 chunks."""
|
|
|
|
|
54 |
if not GEMINI_API_KEY:
|
55 |
return "Erreur : La clé API Gemini n'est pas configurée.", ""
|
56 |
|
@@ -107,8 +109,7 @@ with gr.Blocks() as demo:
|
|
107 |
qa_button.click(
|
108 |
fn=qa,
|
109 |
inputs=question_input,
|
110 |
-
outputs=[answer_output, prompt_output]
|
111 |
-
extra_inputs=[index]
|
112 |
)
|
113 |
|
114 |
if __name__ == "__main__":
|
|
|
49 |
if not index:
|
50 |
print("Problème index")
|
51 |
|
52 |
+
def qa(question):
|
53 |
"""Fonction principale pour répondre à la question en utilisant RAG avec jusqu'à 5 chunks."""
|
54 |
+
|
55 |
+
global index # Indique que nous utilisons la variable globale index
|
56 |
if not GEMINI_API_KEY:
|
57 |
return "Erreur : La clé API Gemini n'est pas configurée.", ""
|
58 |
|
|
|
109 |
qa_button.click(
|
110 |
fn=qa,
|
111 |
inputs=question_input,
|
112 |
+
outputs=[answer_output, prompt_output]
|
|
|
113 |
)
|
114 |
|
115 |
if __name__ == "__main__":
|