Spaces:
Sleeping
Sleeping
Update app.py
Browse filesRejoin collection
app.py
CHANGED
|
@@ -1,15 +1,24 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def run_query(query_string: str):
|
| 4 |
-
meal_string =
|
| 5 |
return meal_string
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
meal_search.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import utils
|
| 3 |
+
|
| 4 |
+
def setup(collection):
|
| 5 |
+
data_loads = utils.load_data()
|
| 6 |
+
utils.chroma_upserting(collection, data_loads)
|
| 7 |
|
| 8 |
def run_query(query_string: str):
|
| 9 |
+
meal_string = util.search_chroma()
|
| 10 |
return meal_string
|
| 11 |
|
| 12 |
+
if __name__ == "__main__":
|
| 13 |
+
collection = utils.chroma_client_setup()
|
| 14 |
+
setup(collection)
|
| 15 |
+
with gr.Blocks() as meal_search:
|
| 16 |
+
gr.Markdown("Start typing below and then click **Run** to see the output.")
|
| 17 |
+
with gr.Row():
|
| 18 |
+
inp = gr.Textbox(placeholder="What sort of meal are you after?")
|
| 19 |
+
out = gr.Textbox()
|
| 20 |
+
btn = gr.Button("Run")
|
| 21 |
+
btn.click(fn=run_query, inputs=inp, outputs=out)
|
| 22 |
+
|
| 23 |
+
meal_search.launch()
|
| 24 |
|
|
|