Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,22 @@
|
|
1 |
-
|
2 |
import streamlit as st
|
3 |
-
from
|
4 |
-
from rag_utils import nettoyer_context
|
5 |
|
6 |
-
st.
|
|
|
7 |
|
|
|
8 |
index, documents = load_faiss_index()
|
9 |
model_embed = get_embedding_model()
|
10 |
|
|
|
11 |
user_input = st.text_input("Pose ta question ici :")
|
12 |
|
13 |
if user_input:
|
14 |
top_docs = query_index(user_input, index, documents, model_embed)
|
15 |
context = nettoyer_context("\n".join(top_docs))
|
16 |
-
print("🧠 Résultats RAG :", top_docs)
|
17 |
response = generate_answer(user_input, context)
|
18 |
-
|
|
|
19 |
st.write(response)
|
20 |
|
21 |
st.markdown("---")
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from rag_utils_llamacpp import load_faiss_index, get_embedding_model, query_index, generate_answer, nettoyer_context
|
|
|
3 |
|
4 |
+
st.set_page_config(page_title="🎓 EduPilot", page_icon="🧠")
|
5 |
+
st.title("🎓 EduPilot (LLM local quantisé)")
|
6 |
|
7 |
+
# Chargement de l’index et du modèle d'embedding
|
8 |
index, documents = load_faiss_index()
|
9 |
model_embed = get_embedding_model()
|
10 |
|
11 |
+
# Interface utilisateur
|
12 |
user_input = st.text_input("Pose ta question ici :")
|
13 |
|
14 |
if user_input:
|
15 |
top_docs = query_index(user_input, index, documents, model_embed)
|
16 |
context = nettoyer_context("\n".join(top_docs))
|
|
|
17 |
response = generate_answer(user_input, context)
|
18 |
+
|
19 |
+
st.markdown("### ✨ Réponse d'Edu Pilot :")
|
20 |
st.write(response)
|
21 |
|
22 |
st.markdown("---")
|