Spaces:
Running
on
Zero
Running
on
Zero
tokenizer messing smth up
Browse files
app.py
CHANGED
|
@@ -53,7 +53,7 @@ def run_example(task_prompt, image, text_input=None):
|
|
| 53 |
task=task_prompt,
|
| 54 |
image_size=(image.width, image.height)
|
| 55 |
)
|
| 56 |
-
return parsed_answer
|
| 57 |
|
| 58 |
def plot_bbox(image, data):
|
| 59 |
fig, ax = plt.subplots()
|
|
@@ -114,7 +114,7 @@ def process_image(image, task_prompt, text_input=None):
|
|
| 114 |
if task_prompt == 'Document Visual Question Answering':
|
| 115 |
task_prompt = '<DocVQA>'
|
| 116 |
results = run_example(task_prompt, image, text_input)
|
| 117 |
-
return results
|
| 118 |
elif task_prompt == 'Caption':
|
| 119 |
task_prompt = '<CAPTION>'
|
| 120 |
results = run_example(task_prompt, image)
|
|
|
|
| 53 |
task=task_prompt,
|
| 54 |
image_size=(image.width, image.height)
|
| 55 |
)
|
| 56 |
+
return parsed_answer[task_prompt].replace("<pad>", "")
|
| 57 |
|
| 58 |
def plot_bbox(image, data):
|
| 59 |
fig, ax = plt.subplots()
|
|
|
|
| 114 |
if task_prompt == 'Document Visual Question Answering':
|
| 115 |
task_prompt = '<DocVQA>'
|
| 116 |
results = run_example(task_prompt, image, text_input)
|
| 117 |
+
return results, None
|
| 118 |
elif task_prompt == 'Caption':
|
| 119 |
task_prompt = '<CAPTION>'
|
| 120 |
results = run_example(task_prompt, image)
|