EvgenyK commited on
Commit
b081923
·
1 Parent(s): 7ae8522

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -5
app.py CHANGED
@@ -47,8 +47,25 @@ def find_best_matches(text):
47
  return matched_images
48
 
49
 
50
- #Gradio app
51
- iface = gr.Interface(fn=find_best_matches, inputs=[gr.inputs.Textbox(lines=1, label="Text query", placeholder="Introduce the search text...",)],
52
- theme = "dark",
53
- outputs=gr.outputs.Carousel([gr.outputs.Image(type="pil")]),
54
- enable_queue=True).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  return matched_images
48
 
49
 
50
+ #Gradio app
51
+ with gr.Blocks() as demo:
52
+ with gr.Column(variant="panel"):
53
+ with gr.Row(variant="compact"):
54
+ text = gr.Textbox(
55
+ label="Search product",
56
+ show_label=False,
57
+ max_lines=1,
58
+ placeholder="Type product",
59
+ ).style(
60
+ container=False,
61
+ )
62
+ btn = gr.Button("Search").style(full_width=False)
63
+
64
+ gallery = gr.Gallery(
65
+ label="Products", show_label=False, elem_id="gallery"
66
+ ).style(grid=[2], height="auto")
67
+
68
+ btn.click(find_best_matches, None, gallery)
69
+
70
+
71
+ demo.launch()