Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
import subprocess
|
| 3 |
import torch
|
| 4 |
from PIL import Image
|
| 5 |
-
from transformers import
|
| 6 |
|
| 7 |
# import os
|
| 8 |
# import random
|
|
@@ -13,7 +13,7 @@ subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENT
|
|
| 13 |
|
| 14 |
# Initialize Florence model
|
| 15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 16 |
-
florence_model =
|
| 17 |
florence_processor = AutoProcessor.from_pretrained('microsoft/Florence-2-base', trust_remote_code=True)
|
| 18 |
|
| 19 |
# api_key = os.getenv("HF_READ_TOKEN")
|
|
|
|
| 2 |
import subprocess
|
| 3 |
import torch
|
| 4 |
from PIL import Image
|
| 5 |
+
from transformers import AutoProcessor, AutoModelForCausalLM
|
| 6 |
|
| 7 |
# import os
|
| 8 |
# import random
|
|
|
|
| 13 |
|
| 14 |
# Initialize Florence model
|
| 15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 16 |
+
florence_model = AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-base', trust_remote_code=True).to(device).eval()
|
| 17 |
florence_processor = AutoProcessor.from_pretrained('microsoft/Florence-2-base', trust_remote_code=True)
|
| 18 |
|
| 19 |
# api_key = os.getenv("HF_READ_TOKEN")
|