Update app.py
Browse files
app.py
CHANGED
@@ -17,12 +17,12 @@ import subprocess
|
|
17 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
18 |
|
19 |
models = {
|
20 |
-
'J-LAB/
|
21 |
'J-LAB/Florence_2_L_FluxiAI_Product_Caption': AutoModelForCausalLM.from_pretrained('J-LAB/Florence_2_L_FluxiAI_Product_Caption', trust_remote_code=True).to("cuda").eval()
|
22 |
}
|
23 |
|
24 |
processors = {
|
25 |
-
'J-LAB/
|
26 |
'J-LAB/Florence_2_L_FluxiAI_Product_Caption': AutoProcessor.from_pretrained('J-LAB/Florence_2_L_FluxiAI_Product_Caption', trust_remote_code=True)
|
27 |
}
|
28 |
|
@@ -117,7 +117,7 @@ def draw_ocr_bboxes(image, prediction):
|
|
117 |
fill=color)
|
118 |
return image
|
119 |
|
120 |
-
def process_image(image, task_prompt, text_input=None, model_id='J-LAB/
|
121 |
image = Image.fromarray(image) # Convert NumPy array to PIL Image
|
122 |
if task_prompt == 'Product Caption':
|
123 |
task_prompt = '<MORE_DETAILED_CAPTION>'
|
@@ -151,7 +151,7 @@ with gr.Blocks(css=css) as demo:
|
|
151 |
with gr.Row():
|
152 |
with gr.Column():
|
153 |
input_img = gr.Image(label="Input Picture")
|
154 |
-
model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value='J-LAB/
|
155 |
task_type = gr.Radio(choices=['Single task', 'Cascased task'], label='Task type selector', value='Single task')
|
156 |
task_prompt = gr.Dropdown(choices=single_task_list, label="Task Prompt", value="Caption")
|
157 |
text_input = gr.Textbox(label="Text Input (optional)")
|
|
|
17 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
18 |
|
19 |
models = {
|
20 |
+
'J-LAB/Florence_2_B_FluxiAI_Product_Caption': AutoModelForCausalLM.from_pretrained('J-LAB/Florence_2_B_FluxiAI_Product_Caption', trust_remote_code=True).to("cuda").eval(),
|
21 |
'J-LAB/Florence_2_L_FluxiAI_Product_Caption': AutoModelForCausalLM.from_pretrained('J-LAB/Florence_2_L_FluxiAI_Product_Caption', trust_remote_code=True).to("cuda").eval()
|
22 |
}
|
23 |
|
24 |
processors = {
|
25 |
+
'J-LAB/Florence_2_B_FluxiAI_Product_Caption': AutoProcessor.from_pretrained('J-LAB/Florence_2_B_FluxiAI_Product_Caption', trust_remote_code=True),
|
26 |
'J-LAB/Florence_2_L_FluxiAI_Product_Caption': AutoProcessor.from_pretrained('J-LAB/Florence_2_L_FluxiAI_Product_Caption', trust_remote_code=True)
|
27 |
}
|
28 |
|
|
|
117 |
fill=color)
|
118 |
return image
|
119 |
|
120 |
+
def process_image(image, task_prompt, text_input=None, model_id='J-LAB/Florence_2_B_FluxiAI_Product_Caption'):
|
121 |
image = Image.fromarray(image) # Convert NumPy array to PIL Image
|
122 |
if task_prompt == 'Product Caption':
|
123 |
task_prompt = '<MORE_DETAILED_CAPTION>'
|
|
|
151 |
with gr.Row():
|
152 |
with gr.Column():
|
153 |
input_img = gr.Image(label="Input Picture")
|
154 |
+
model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value='J-LAB/Florence_2_B_FluxiAI_Product_Caption')
|
155 |
task_type = gr.Radio(choices=['Single task', 'Cascased task'], label='Task type selector', value='Single task')
|
156 |
task_prompt = gr.Dropdown(choices=single_task_list, label="Task Prompt", value="Caption")
|
157 |
text_input = gr.Textbox(label="Text Input (optional)")
|