Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ from PIL import Image
|
|
| 7 |
import subprocess
|
| 8 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 9 |
|
| 10 |
-
model_id = 'J-LAB/
|
| 11 |
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True).to("cuda").eval()
|
| 12 |
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
| 13 |
|
|
@@ -35,7 +35,7 @@ def run_example(task_prompt, image):
|
|
| 35 |
def process_image(image, task_prompt):
|
| 36 |
image = Image.fromarray(image) # Convert NumPy array to PIL Image
|
| 37 |
if task_prompt == 'Product Caption':
|
| 38 |
-
task_prompt = '<
|
| 39 |
elif task_prompt == 'OCR':
|
| 40 |
task_prompt = '<OCR>'
|
| 41 |
|
|
|
|
| 7 |
import subprocess
|
| 8 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 9 |
|
| 10 |
+
model_id = 'J-LAB/Florence_2_L_FluxiAI_Product_Caption'
|
| 11 |
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True).to("cuda").eval()
|
| 12 |
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
| 13 |
|
|
|
|
| 35 |
def process_image(image, task_prompt):
|
| 36 |
image = Image.fromarray(image) # Convert NumPy array to PIL Image
|
| 37 |
if task_prompt == 'Product Caption':
|
| 38 |
+
task_prompt = '<MORE_DETAILED_CAPTION>'
|
| 39 |
elif task_prompt == 'OCR':
|
| 40 |
task_prompt = '<OCR>'
|
| 41 |
|