Spaces:
Runtime error
Runtime error
update layout
Browse files
app.py
CHANGED
@@ -57,6 +57,7 @@ def Image_similarity_search(image_in, search_query):
|
|
57 |
#Defining Gradio Blocks
|
58 |
with gr.Blocks(css = """#label_mid {padding-top: 2px; padding-bottom: 2px;}
|
59 |
#label_results {padding-top: 5px; padding-bottom: 1px;}
|
|
|
60 |
""") as demo:
|
61 |
with gr.Row():
|
62 |
gr.HTML("""<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
@@ -82,9 +83,9 @@ with gr.Blocks(css = """#label_mid {padding-top: 2px; padding-bottom: 2px;}
|
|
82 |
Finally, a similarity search is performed over the vector space and the top result is returned.
|
83 |
<center><a href="https://huggingface.co/spaces/ysharma/Blip_PlaygroundAI?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a></center>
|
84 |
</p></div>""")
|
85 |
-
with gr.Column(scale=3):
|
86 |
-
|
87 |
-
with gr.Column(
|
88 |
label_top = gr.HTML(value= "<center>🖼️Upload an Image for your search📷</center>", elem_id="label_top")
|
89 |
image_in = gr.Image(label="Upoload an Image for search", type='filepath', elem_id="image_in")
|
90 |
label_mid = gr.HTML(value= "<p style='text-align: center; color: red;'>Or</center></p>", elem_id='label_mid')
|
@@ -94,10 +95,11 @@ with gr.Blocks(css = """#label_mid {padding-top: 2px; padding-bottom: 2px;}
|
|
94 |
label_results = gr.HTML(value= "<p style='text-align: center; color: blue; font-weight: bold;'>Search results from PlaygroundAI</center></p>", elem_id="label_results")
|
95 |
img_search = gr.HTML(label = 'Image search results from PlaygroundAI dataset', elem_id="img_search")
|
96 |
pai_prompt = gr.Textbox(label="Image prompt from PlaygroundAI dataset", elem_id="pai_prompt")
|
97 |
-
with gr.Column(scale=3):
|
98 |
-
|
99 |
|
100 |
-
image_in.change(Image_similarity_search, [image_in, search_query], [pai_prompt, img_search], api_name="
|
|
|
101 |
#b1.click(Image_similarity_search, image_in, [pai_prompt, img_search] )
|
102 |
|
103 |
demo.launch(debug=True)
|
|
|
57 |
#Defining Gradio Blocks
|
58 |
with gr.Blocks(css = """#label_mid {padding-top: 2px; padding-bottom: 2px;}
|
59 |
#label_results {padding-top: 5px; padding-bottom: 1px;}
|
60 |
+
#col-container {max-width: 580px; margin-left: auto; margin-right: auto;}
|
61 |
""") as demo:
|
62 |
with gr.Row():
|
63 |
gr.HTML("""<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
|
|
83 |
Finally, a similarity search is performed over the vector space and the top result is returned.
|
84 |
<center><a href="https://huggingface.co/spaces/ysharma/Blip_PlaygroundAI?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a></center>
|
85 |
</p></div>""")
|
86 |
+
#with gr.Column(scale=3):
|
87 |
+
# pass
|
88 |
+
with gr.Column(elem_id = "col-container"):
|
89 |
label_top = gr.HTML(value= "<center>🖼️Upload an Image for your search📷</center>", elem_id="label_top")
|
90 |
image_in = gr.Image(label="Upoload an Image for search", type='filepath', elem_id="image_in")
|
91 |
label_mid = gr.HTML(value= "<p style='text-align: center; color: red;'>Or</center></p>", elem_id='label_mid')
|
|
|
95 |
label_results = gr.HTML(value= "<p style='text-align: center; color: blue; font-weight: bold;'>Search results from PlaygroundAI</center></p>", elem_id="label_results")
|
96 |
img_search = gr.HTML(label = 'Image search results from PlaygroundAI dataset', elem_id="img_search")
|
97 |
pai_prompt = gr.Textbox(label="Image prompt from PlaygroundAI dataset", elem_id="pai_prompt")
|
98 |
+
#with gr.Column(scale=3):
|
99 |
+
# pass
|
100 |
|
101 |
+
image_in.change(Image_similarity_search, [image_in, search_query], [pai_prompt, img_search], api_name="PlaygroundAI_image_search" )
|
102 |
+
search_query.submit(Image_similarity_search, image_in, [pai_prompt, img_search], api_name='PlaygroundAI_text_search' )
|
103 |
#b1.click(Image_similarity_search, image_in, [pai_prompt, img_search] )
|
104 |
|
105 |
demo.launch(debug=True)
|