J-LAB commited on
Commit
110cd3e
·
verified ·
1 Parent(s): 0ac529d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -18,10 +18,12 @@ subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENT
18
 
19
  models = {
20
  'J-LAB/Florence-Idesire': AutoModelForCausalLM.from_pretrained('J-LAB/Florence-Idesire', trust_remote_code=True).to("cuda").eval()
 
21
  }
22
 
23
  processors = {
24
  'J-LAB/Florence-Idesire': AutoProcessor.from_pretrained('J-LAB/Florence-Idesire', trust_remote_code=True),
 
25
  }
26
 
27
 
@@ -117,8 +119,8 @@ def draw_ocr_bboxes(image, prediction):
117
 
118
  def process_image(image, task_prompt, text_input=None, model_id='J-LAB/Florence-Idesire'):
119
  image = Image.fromarray(image) # Convert NumPy array to PIL Image
120
- if task_prompt == 'Caption':
121
- task_prompt = '<CAPTION>'
122
  results = run_example(task_prompt, image, model_id=model_id)
123
  return results, None
124
  elif task_prompt == 'Detailed Caption':
 
18
 
19
  models = {
20
  'J-LAB/Florence-Idesire': AutoModelForCausalLM.from_pretrained('J-LAB/Florence-Idesire', 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-Idesire': AutoProcessor.from_pretrained('J-LAB/Florence-Idesire', 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
 
29
 
 
119
 
120
  def process_image(image, task_prompt, text_input=None, model_id='J-LAB/Florence-Idesire'):
121
  image = Image.fromarray(image) # Convert NumPy array to PIL Image
122
+ if task_prompt == 'More Detailed Caption':
123
+ task_prompt = '<MORE_DETAILED_CAPTION>'
124
  results = run_example(task_prompt, image, model_id=model_id)
125
  return results, None
126
  elif task_prompt == 'Detailed Caption':