initial code
Browse files
app.py
CHANGED
@@ -59,15 +59,29 @@ def respond(query):
|
|
59 |
|
60 |
return response.objects[0].properties
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
|
73 |
if __name__ == "__main__":
|
|
|
59 |
|
60 |
return response.objects[0].properties
|
61 |
|
62 |
+
with gr.Blocks(title="Search the Jeopardy Vector Database powered by Weaviate) as demo:
|
63 |
+
gr.Markdown("""# Search the Jeopardy Vector Database powered by Weaviate""")
|
64 |
+
semantic_examples = [
|
65 |
+
["Computers"],
|
66 |
+
["Computer Software"],
|
67 |
+
["Pharmaceuticals"],
|
68 |
+
["Consumer Products"],
|
69 |
+
["Commodities"],
|
70 |
+
["Retail"],
|
71 |
+
["Manufacturing"],
|
72 |
+
["Energy"],
|
73 |
+
["National Defense"],
|
74 |
+
["Auto Makers"]
|
75 |
+
]
|
76 |
+
gr.Markdown("""### Begin with a search.""")
|
77 |
+
semantic_input_text = gr.Textbox(label="Enter a search concept or choose an example below:", value=semantic_examples[0][0])
|
78 |
+
gr.Examples(semantic_examples,
|
79 |
+
fn=respond,
|
80 |
+
inputs=semantic_input_text, label="Example search concepts:"
|
81 |
+
)
|
82 |
+
vdb_button = gr.Button(value="Search the financial vector database.")
|
83 |
+
vdb_button.click(fn=respond, inputs=[semantic_input_text], outputs=gr.Textbox(label="Search Results (Filters = Name)"))
|
84 |
+
|
85 |
|
86 |
|
87 |
if __name__ == "__main__":
|