Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,6 +32,8 @@ def set_labels(text):
|
|
| 32 |
get_caption = gr.load("ryaalbr/caption", src="spaces", hf_token=environ["api_key"])
|
| 33 |
def generate_text(image, model_name):
|
| 34 |
return get_caption(image, model_name)
|
|
|
|
|
|
|
| 35 |
|
| 36 |
with gr.Blocks() as demo:
|
| 37 |
|
|
@@ -76,7 +78,14 @@ with gr.Blocks() as demo:
|
|
| 76 |
caption = gr.Textbox(label='Caption')
|
| 77 |
get_btn_cap.click(fn=rand_image, outputs=im_cap)
|
| 78 |
#im_cap.change(generate_text, inputs=im_cap, outputs=caption)
|
| 79 |
-
caption_btn.click(generate_text, inputs=[im_cap, model_name], outputs=caption)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
demo.queue()
|
| 82 |
demo.launch()
|
|
|
|
| 32 |
get_caption = gr.load("ryaalbr/caption", src="spaces", hf_token=environ["api_key"])
|
| 33 |
def generate_text(image, model_name):
|
| 34 |
return get_caption(image, model_name)
|
| 35 |
+
|
| 36 |
+
get_images = gr.load("ryaalbr/ImageSearch", src="spaces", hf_token=environ["api_key"])
|
| 37 |
|
| 38 |
with gr.Blocks() as demo:
|
| 39 |
|
|
|
|
| 78 |
caption = gr.Textbox(label='Caption')
|
| 79 |
get_btn_cap.click(fn=rand_image, outputs=im_cap)
|
| 80 |
#im_cap.change(generate_text, inputs=im_cap, outputs=caption)
|
| 81 |
+
caption_btn.click(generate_text, inputs=[im_cap, model_name], outputs=caption)
|
| 82 |
+
|
| 83 |
+
with gr.Tab("Image Search"):
|
| 84 |
+
with gr.Column(variant="panel"):
|
| 85 |
+
desc = gr.Textbox(show_label=False, placeholder="Enter description").style(container=False)
|
| 86 |
+
search_btn = gr.Button("Find Images").style(full_width=False)
|
| 87 |
+
gallery = gr.Gallery(show_label=False).style(grid=(2,2,3,5))
|
| 88 |
+
search_btn.click(get_images,inputs=desc, outputs=gallery)
|
| 89 |
|
| 90 |
demo.queue()
|
| 91 |
demo.launch()
|