Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -127,15 +127,7 @@ def inference_seg_cap(image_input, point_prompt, language, sentiment, factuality
|
|
127 |
|
128 |
out = model.inference(image_input, prompt, controls)
|
129 |
state = state + [(None, "Image point: {}, Input label: {}".format(prompt["input_point"], prompt["input_label"]))]
|
130 |
-
|
131 |
-
# state = state + [(f'{k}: {v}', None)]
|
132 |
-
# state = state + [("caption: {}".format(out['generated_captions']['raw_caption']), None)]
|
133 |
-
# wiki = out['generated_captions'].get('wiki', "")
|
134 |
-
# click_state[2].append(out['generated_captions']['raw_caption'])
|
135 |
-
|
136 |
-
# text = out['generated_captions']['raw_caption']
|
137 |
-
# draw = ImageDraw.Draw(image_input)
|
138 |
-
# draw.text((evt.index[0], evt.index[1]), text, textcolor=(0,0,255), text_size=120)
|
139 |
input_mask = np.array(out['mask'].convert('P'))
|
140 |
image_input = mask_painter(np.array(image_input), input_mask)
|
141 |
origin_image_input = image_input
|
@@ -143,13 +135,6 @@ def inference_seg_cap(image_input, point_prompt, language, sentiment, factuality
|
|
143 |
image_input = create_bubble_frame(image_input, text, (evt.index[0], evt.index[1]))
|
144 |
|
145 |
yield state, state, click_state, image_input, input_mask
|
146 |
-
# if not args.disable_gpt and model.text_refiner:
|
147 |
-
# refined_caption = model.text_refiner.inference(query=text, controls=controls, context=out['context_captions'])
|
148 |
-
# # new_cap = 'Original: ' + text + '. Refined: ' + refined_caption['caption']
|
149 |
-
# new_cap = refined_caption['caption']
|
150 |
-
# refined_image_input = create_bubble_frame(origin_image_input, new_cap, (evt.index[0], evt.index[1]))
|
151 |
-
# yield state, state, click_state, chat_input, refined_image_input, wiki
|
152 |
-
|
153 |
|
154 |
def upload_callback(image_input, state):
|
155 |
state = [] + [('Image size: ' + str(image_input.size), None)]
|
|
|
127 |
|
128 |
out = model.inference(image_input, prompt, controls)
|
129 |
state = state + [(None, "Image point: {}, Input label: {}".format(prompt["input_point"], prompt["input_label"]))]
|
130 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
input_mask = np.array(out['mask'].convert('P'))
|
132 |
image_input = mask_painter(np.array(image_input), input_mask)
|
133 |
origin_image_input = image_input
|
|
|
135 |
image_input = create_bubble_frame(image_input, text, (evt.index[0], evt.index[1]))
|
136 |
|
137 |
yield state, state, click_state, image_input, input_mask
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
def upload_callback(image_input, state):
|
140 |
state = [] + [('Image size: ' + str(image_input.size), None)]
|