chore: adding title
Browse files
app.py
CHANGED
@@ -41,10 +41,34 @@ def process_query(query):
|
|
41 |
response = generated_outputs[0][len_text:]
|
42 |
return url, response
|
43 |
|
44 |
-
demo = gr.Interface(
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
)
|
49 |
|
50 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
response = generated_outputs[0][len_text:]
|
42 |
return url, response
|
43 |
|
44 |
+
# demo = gr.Interface(
|
45 |
+
# fn=process_query,
|
46 |
+
# inputs=gr.Textbox(label="User Query"),
|
47 |
+
# outputs=[gr.Textbox(label="URL"), gr.Textbox(label="Generated Response")]
|
48 |
+
# )
|
49 |
|
50 |
+
# demo.launch()
|
51 |
+
|
52 |
+
|
53 |
+
demo = gr.Blocks()
|
54 |
+
|
55 |
+
with demo:
|
56 |
+
gr.Markdown("# RAG on PyImageSearch blog posts")
|
57 |
+
gr.Markdown("This interface processes a user query by finding the most relevant context from PyImageSearch and generating a detailed response.")
|
58 |
+
|
59 |
+
with gr.Row():
|
60 |
+
with gr.Column():
|
61 |
+
user_query = gr.Textbox(label="User Query", placeholder="Enter your query here...", lines=2)
|
62 |
+
with gr.Column():
|
63 |
+
search_url = gr.Textbox(label="URL", interactive=False)
|
64 |
+
generated_response = gr.Textbox(label="Generated Response", interactive=False)
|
65 |
+
|
66 |
+
submit_button = gr.Button("Submit")
|
67 |
+
|
68 |
+
submit_button.click(
|
69 |
+
fn=process_query,
|
70 |
+
inputs=user_query,
|
71 |
+
outputs=[search_url, generated_response]
|
72 |
+
)
|
73 |
+
|
74 |
+
demo.launch()
|