Update app.py
Browse files
app.py
CHANGED
|
@@ -29,10 +29,10 @@ def respond(
|
|
| 29 |
top_p,
|
| 30 |
):
|
| 31 |
#messages = [{"role": "system", "content": system_message}]
|
| 32 |
-
messages = ""
|
| 33 |
|
| 34 |
|
| 35 |
-
|
|
|
|
| 36 |
|
| 37 |
response = ""
|
| 38 |
|
|
@@ -44,7 +44,7 @@ def respond(
|
|
| 44 |
|
| 45 |
"""
|
| 46 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 47 |
-
|
| 48 |
demo = gr.ChatInterface(
|
| 49 |
respond,
|
| 50 |
additional_inputs=[
|
|
@@ -60,7 +60,29 @@ demo = gr.ChatInterface(
|
|
| 60 |
),
|
| 61 |
],
|
| 62 |
)
|
| 63 |
-
|
| 64 |
|
| 65 |
if __name__ == "__main__":
|
| 66 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
top_p,
|
| 30 |
):
|
| 31 |
#messages = [{"role": "system", "content": system_message}]
|
|
|
|
| 32 |
|
| 33 |
|
| 34 |
+
messages = [
|
| 35 |
+
{"role": "user", "content": f"{massage}"}]
|
| 36 |
|
| 37 |
response = ""
|
| 38 |
|
|
|
|
| 44 |
|
| 45 |
"""
|
| 46 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 47 |
+
|
| 48 |
demo = gr.ChatInterface(
|
| 49 |
respond,
|
| 50 |
additional_inputs=[
|
|
|
|
| 60 |
),
|
| 61 |
],
|
| 62 |
)
|
| 63 |
+
"""
|
| 64 |
|
| 65 |
if __name__ == "__main__":
|
| 66 |
+
demo.launch()
|
| 67 |
+
|
| 68 |
+
# Modify the Gradio interface
|
| 69 |
+
with gr.Blocks() as demo:
|
| 70 |
+
gr.Markdown("## RAG with PostgreSQL, pgvector, and OpenAI")
|
| 71 |
+
with gr.Row():
|
| 72 |
+
with gr.Column():
|
| 73 |
+
query_input = gr.Textbox(label="Enter your query")
|
| 74 |
+
search_button = gr.Button("Search & Get Answer")
|
| 75 |
+
results_output = gr.Textbox(label="Response", lines=5)
|
| 76 |
+
search_button.click(fn=respond, inputs=[query_input], outputs=[results_output])
|
| 77 |
+
additional_inputs=[
|
| 78 |
+
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
| 79 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 80 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 81 |
+
gr.Slider(
|
| 82 |
+
minimum=0.1,
|
| 83 |
+
maximum=1.0,
|
| 84 |
+
value=0.95,
|
| 85 |
+
step=0.05,
|
| 86 |
+
label="Top-p (nucleus sampling)",
|
| 87 |
+
),]
|
| 88 |
+
demo.launch()
|