Spaces:
Sleeping
Sleeping
ionosphere
commited on
Commit
·
eb39769
1
Parent(s):
4c8c543
Update interface
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ from llama_index.query_engine import RetrieverQueryEngine
|
|
9 |
|
10 |
title = "Gaia Mistral Chat RAG URL Demo"
|
11 |
description = "Example of an assistant with Gradio, RAG from url and Mistral AI via its API"
|
12 |
-
placeholder = "
|
13 |
placeholder_url = "Extract text from this url"
|
14 |
llm_model = 'mistral-small'
|
15 |
# choose api_key from .env or from input field
|
@@ -25,9 +25,6 @@ with gr.Blocks() as demo:
|
|
25 |
This demo allows you to interact with a webpage and then ask questions to Mistral APIs.
|
26 |
Mistral will answer with the context extracted from the webpage.
|
27 |
""")
|
28 |
-
chatbot = gr.Chatbot()
|
29 |
-
msg = gr.Textbox()
|
30 |
-
clear = gr.ClearButton([msg, chatbot])
|
31 |
|
32 |
# with gr.Row():
|
33 |
# api_key_text_box = gr.Textbox(placeholder=placeholder_api_key, container=False, scale=7)
|
@@ -46,10 +43,18 @@ with gr.Blocks() as demo:
|
|
46 |
query_engine = index.as_query_engine(similarity_top_k=15)
|
47 |
return placeholder
|
48 |
|
|
|
|
|
49 |
with gr.Row():
|
50 |
url_msg = gr.Textbox(placeholder=placeholder_url, container=False, scale=7)
|
51 |
-
url_btn = gr.Button(value="
|
52 |
-
url_btn.click(setup_with_url, [url_msg],
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
def respond(message, chat_history):
|
55 |
response = query_engine.query(message)
|
|
|
9 |
|
10 |
title = "Gaia Mistral Chat RAG URL Demo"
|
11 |
description = "Example of an assistant with Gradio, RAG from url and Mistral AI via its API"
|
12 |
+
placeholder = "Vous pouvez me posez une question sur ce contexte, appuyer sur Entrée pour valider"
|
13 |
placeholder_url = "Extract text from this url"
|
14 |
llm_model = 'mistral-small'
|
15 |
# choose api_key from .env or from input field
|
|
|
25 |
This demo allows you to interact with a webpage and then ask questions to Mistral APIs.
|
26 |
Mistral will answer with the context extracted from the webpage.
|
27 |
""")
|
|
|
|
|
|
|
28 |
|
29 |
# with gr.Row():
|
30 |
# api_key_text_box = gr.Textbox(placeholder=placeholder_api_key, container=False, scale=7)
|
|
|
43 |
query_engine = index.as_query_engine(similarity_top_k=15)
|
44 |
return placeholder
|
45 |
|
46 |
+
gr.Markdown(""" ### 1 / Extract data from URL """)
|
47 |
+
|
48 |
with gr.Row():
|
49 |
url_msg = gr.Textbox(placeholder=placeholder_url, container=False, scale=7)
|
50 |
+
url_btn = gr.Button(value="Process url ✅", interactive=True)
|
51 |
+
url_btn.click(setup_with_url, [url_msg], url_msg, show_progress= "full")
|
52 |
+
|
53 |
+
gr.Markdown(""" ### 2 / Ask a question about this context """)
|
54 |
+
|
55 |
+
chatbot = gr.Chatbot()
|
56 |
+
msg = gr.Textbox(placeholder=placeholder)
|
57 |
+
clear = gr.ClearButton([msg, chatbot])
|
58 |
|
59 |
def respond(message, chat_history):
|
60 |
response = query_engine.query(message)
|