Spaces:
Paused
Paused
Carlos Rosas
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -54,8 +54,8 @@ def hybrid_search(text):
|
|
54 |
title = row['section']
|
55 |
content = row['text']
|
56 |
|
57 |
-
document.append(f"
|
58 |
-
document_html.append(f'<div class="source" id="{hash_id}"><p><b>{hash_id}</b> :
|
59 |
|
60 |
document = "\n\n".join(document)
|
61 |
document_html = '<div id="source_listing">' + "".join(document_html) + "</div>"
|
@@ -68,7 +68,7 @@ class CassandreChatBot:
|
|
68 |
def predict(self, user_message):
|
69 |
fiches, fiches_html = hybrid_search(user_message)
|
70 |
|
71 |
-
detailed_prompt = f"""
|
72 |
|
73 |
# Convert inputs to tensor
|
74 |
input_ids = tokenizer.encode(detailed_prompt, return_tensors="pt").to(device)
|
@@ -190,13 +190,13 @@ def gradio_interface(user_message):
|
|
190 |
demo = gr.Blocks(css=css)
|
191 |
|
192 |
with demo:
|
193 |
-
gr.HTML("""<h1 style="text-align:center">
|
194 |
with gr.Row():
|
195 |
with gr.Column(scale=2):
|
196 |
text_input = gr.Textbox(label="Votre question ou votre instruction", lines=3)
|
197 |
-
text_button = gr.Button("Interroger
|
198 |
with gr.Column(scale=3):
|
199 |
-
text_output = gr.HTML(label="La réponse de
|
200 |
with gr.Row():
|
201 |
embedding_output = gr.HTML(label="Les sources utilisées")
|
202 |
|
|
|
54 |
title = row['section']
|
55 |
content = row['text']
|
56 |
|
57 |
+
document.append(f"<|source_id_start|>{hash_id}<|source_id_end|>\n{content}")
|
58 |
+
document_html.append(f'<div class="source" id="{hash_id}"><p><b>{hash_id}</b> : <br>{content}</div>')
|
59 |
|
60 |
document = "\n\n".join(document)
|
61 |
document_html = '<div id="source_listing">' + "".join(document_html) + "</div>"
|
|
|
68 |
def predict(self, user_message):
|
69 |
fiches, fiches_html = hybrid_search(user_message)
|
70 |
|
71 |
+
detailed_prompt = f"""<|query_start|>{user_message}<|query_end|>\n### Source ###\n{fiches}\n\n<|source_analysis_start|>\n"""
|
72 |
|
73 |
# Convert inputs to tensor
|
74 |
input_ids = tokenizer.encode(detailed_prompt, return_tensors="pt").to(device)
|
|
|
190 |
demo = gr.Blocks(css=css)
|
191 |
|
192 |
with demo:
|
193 |
+
gr.HTML("""<h1 style="text-align:center">pleias-RAG 1.0</h1>""")
|
194 |
with gr.Row():
|
195 |
with gr.Column(scale=2):
|
196 |
text_input = gr.Textbox(label="Votre question ou votre instruction", lines=3)
|
197 |
+
text_button = gr.Button("Interroger pleias-RAG")
|
198 |
with gr.Column(scale=3):
|
199 |
+
text_output = gr.HTML(label="La réponse de pleias-RAG")
|
200 |
with gr.Row():
|
201 |
embedding_output = gr.HTML(label="Les sources utilisées")
|
202 |
|