Update app.py
Browse files
app.py
CHANGED
@@ -11,8 +11,8 @@ processor = ZhCLIPProcessor.from_pretrained(version)
|
|
11 |
|
12 |
|
13 |
|
14 |
-
def get_result(image,text):
|
15 |
-
inputs = processor(text=[text], images=image, return_tensors="pt", padding=True)
|
16 |
|
17 |
outputs = model(**inputs)
|
18 |
image_features = outputs.image_features
|
@@ -32,31 +32,18 @@ with gr.Blocks(
|
|
32 |
image_input = gr.Image(type="pil",label="VQA Image Input")
|
33 |
with gr.Row():
|
34 |
with gr.Column(scale=1):
|
35 |
-
chat_input = gr.Textbox(lines=1, label="
|
|
|
36 |
with gr.Row():
|
37 |
clear_button = gr.Button(value="Clear", interactive=True,width=30)
|
38 |
submit_button = gr.Button(
|
39 |
value="Submit", interactive=True, variant="primary"
|
40 |
)
|
41 |
-
|
42 |
-
cap_submit_button = gr.Button(
|
43 |
-
value="Submit_CAP", interactive=True, variant="primary"
|
44 |
-
)
|
45 |
-
gpt3_submit_button = gr.Button(
|
46 |
-
value="Submit_GPT3", interactive=True, variant="primary"
|
47 |
-
)
|
48 |
-
'''
|
49 |
with gr.Column():
|
50 |
caption_output = gr.Textbox(lines=0, label="ITM")
|
51 |
|
52 |
-
|
53 |
-
get_result,
|
54 |
-
[
|
55 |
-
image_input,
|
56 |
-
chat_input,
|
57 |
-
],
|
58 |
-
[ caption_output],
|
59 |
-
)
|
60 |
clear_button.click(
|
61 |
lambda: ("", [],"","",""),
|
62 |
[],
|
@@ -68,6 +55,7 @@ with gr.Blocks(
|
|
68 |
[
|
69 |
image_input,
|
70 |
chat_input,
|
|
|
71 |
],
|
72 |
[caption_output],
|
73 |
)
|
|
|
11 |
|
12 |
|
13 |
|
14 |
+
def get_result(image,text,text1):
|
15 |
+
inputs = processor(text=[text,text1], images=image, return_tensors="pt", padding=True)
|
16 |
|
17 |
outputs = model(**inputs)
|
18 |
image_features = outputs.image_features
|
|
|
32 |
image_input = gr.Image(type="pil",label="VQA Image Input")
|
33 |
with gr.Row():
|
34 |
with gr.Column(scale=1):
|
35 |
+
chat_input = gr.Textbox(lines=1, label="Captions0 Input")
|
36 |
+
chat_input1 = gr.Textbox(lines=1, label="Captions1 Input")
|
37 |
with gr.Row():
|
38 |
clear_button = gr.Button(value="Clear", interactive=True,width=30)
|
39 |
submit_button = gr.Button(
|
40 |
value="Submit", interactive=True, variant="primary"
|
41 |
)
|
42 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
with gr.Column():
|
44 |
caption_output = gr.Textbox(lines=0, label="ITM")
|
45 |
|
46 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
clear_button.click(
|
48 |
lambda: ("", [],"","",""),
|
49 |
[],
|
|
|
55 |
[
|
56 |
image_input,
|
57 |
chat_input,
|
58 |
+
chat_input1,
|
59 |
],
|
60 |
[caption_output],
|
61 |
)
|