bkoz commited on
Commit
273100b
·
1 Parent(s): 463a101

initial code

Browse files
Files changed (1) hide show
  1. app.py +23 -9
app.py CHANGED
@@ -59,15 +59,29 @@ def respond(query):
59
 
60
  return response.objects[0].properties
61
 
62
- demo = gr.Interface(
63
- gr.Textbox(
64
- label="Search the Jeopardy Vector Database powered by Weaviate",
65
- info="Submit a Query:",
66
- lines=1
67
- ),
68
- examples=["Guitars", "Wine", "Movies", "Sports"],
69
- outputs="textbox"
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__":