Spaces:
Sleeping
Sleeping
byterocker20
commited on
Commit
·
9f93592
1
Parent(s):
b538d20
fix bugs
Browse files- app.py +3 -3
- requirements.txt +2 -1
app.py
CHANGED
@@ -48,7 +48,7 @@ def fig_to_pil(fig):
|
|
48 |
return Image.open(buf)
|
49 |
|
50 |
|
51 |
-
def run_example(task_prompt, image, text_input=None, model_id='microsoft/Florence-2-
|
52 |
with patch("transformers.dynamic_module_utils.get_imports", fixed_get_imports):
|
53 |
model = models[model_id]
|
54 |
processor = processors[model_id]
|
@@ -127,7 +127,7 @@ def draw_ocr_bboxes(image, prediction):
|
|
127 |
fill=color)
|
128 |
return image
|
129 |
|
130 |
-
def process_image(image, task_prompt, text_input=None, model_id='microsoft/Florence-2-
|
131 |
image = Image.fromarray(image) # Convert NumPy array to PIL Image
|
132 |
if task_prompt == 'Caption':
|
133 |
task_prompt = '<CAPTION>'
|
@@ -263,7 +263,7 @@ with gr.Blocks(css=css) as demo:
|
|
263 |
with gr.Row():
|
264 |
with gr.Column():
|
265 |
input_img = gr.Image(label="Input Picture")
|
266 |
-
model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value='microsoft/Florence-2-
|
267 |
task_type = gr.Radio(choices=['Single task', 'Cascased task'], label='Task type selector', value='Single task')
|
268 |
task_prompt = gr.Dropdown(choices=single_task_list, label="Task Prompt", value="Caption")
|
269 |
task_type.change(fn=update_task_dropdown, inputs=task_type, outputs=task_prompt)
|
|
|
48 |
return Image.open(buf)
|
49 |
|
50 |
|
51 |
+
def run_example(task_prompt, image, text_input=None, model_id='microsoft/Florence-2-base'):
|
52 |
with patch("transformers.dynamic_module_utils.get_imports", fixed_get_imports):
|
53 |
model = models[model_id]
|
54 |
processor = processors[model_id]
|
|
|
127 |
fill=color)
|
128 |
return image
|
129 |
|
130 |
+
def process_image(image, task_prompt, text_input=None, model_id='microsoft/Florence-2-base'):
|
131 |
image = Image.fromarray(image) # Convert NumPy array to PIL Image
|
132 |
if task_prompt == 'Caption':
|
133 |
task_prompt = '<CAPTION>'
|
|
|
263 |
with gr.Row():
|
264 |
with gr.Column():
|
265 |
input_img = gr.Image(label="Input Picture")
|
266 |
+
model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value='microsoft/Florence-2-base')
|
267 |
task_type = gr.Radio(choices=['Single task', 'Cascased task'], label='Task type selector', value='Single task')
|
268 |
task_prompt = gr.Dropdown(choices=single_task_list, label="Task Prompt", value="Caption")
|
269 |
task_type.change(fn=update_task_dropdown, inputs=task_type, outputs=task_prompt)
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
transformers
|
2 |
-
timm
|
|
|
|
1 |
transformers
|
2 |
+
timm
|
3 |
+
einops
|