Update app.py
Browse files
app.py
CHANGED
@@ -13,12 +13,6 @@ model = BlipForImageTextRetrieval.from_pretrained("Salesforce/blip-itm-base-coco
|
|
13 |
processor = AutoProcessor.from_pretrained("Salesforce/blip-itm-base-coco")
|
14 |
|
15 |
def process_image(input_type, image_url, image_upload, text):
|
16 |
-
gr.Markdown(
|
17 |
-
"""
|
18 |
-
# Challenge yourself by describing the image - test & demo app by Srinivas.V..
|
19 |
-
Paste either URL of an image or upload the image, describe the image best and submit to know your score.
|
20 |
-
""")
|
21 |
-
|
22 |
if input_type == "URL":
|
23 |
raw_image = Image.open(requests.get(image_url, stream=True).raw).convert('RGB')
|
24 |
else:
|
@@ -59,6 +53,12 @@ def toggle_inputs(input_type):
|
|
59 |
return gr.update(visible=False), gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)
|
60 |
|
61 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
input_type = gr.Radio(choices=["URL", "Upload"], label="Input Type")
|
63 |
image_url = gr.Textbox(label="Image URL", visible=False)
|
64 |
url_image = gr.Image(type="pil", label="URL Image", visible=False)
|
|
|
13 |
processor = AutoProcessor.from_pretrained("Salesforce/blip-itm-base-coco")
|
14 |
|
15 |
def process_image(input_type, image_url, image_upload, text):
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
if input_type == "URL":
|
17 |
raw_image = Image.open(requests.get(image_url, stream=True).raw).convert('RGB')
|
18 |
else:
|
|
|
53 |
return gr.update(visible=False), gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)
|
54 |
|
55 |
with gr.Blocks() as demo:
|
56 |
+
gr.Markdown(
|
57 |
+
"""
|
58 |
+
# Challenge yourself by describing the image - test & demo app by Srinivas.V..
|
59 |
+
Paste either URL of an image or upload the image, describe the image best and submit to know your score.
|
60 |
+
""")
|
61 |
+
|
62 |
input_type = gr.Radio(choices=["URL", "Upload"], label="Input Type")
|
63 |
image_url = gr.Textbox(label="Image URL", visible=False)
|
64 |
url_image = gr.Image(type="pil", label="URL Image", visible=False)
|