Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import re
|
|
4 |
from PIL import Image
|
5 |
import os
|
6 |
import numpy as np
|
7 |
-
import
|
8 |
|
9 |
model = AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-large', trust_remote_code=True).to("cuda").eval()
|
10 |
processor = AutoProcessor.from_pretrained('microsoft/Florence-2-large', trust_remote_code=True)
|
@@ -29,7 +29,7 @@ def modify_caption(caption: str) -> str:
|
|
29 |
|
30 |
return merged_content if merged_content != caption else caption
|
31 |
|
32 |
-
@
|
33 |
def process_image(image):
|
34 |
if isinstance(image, np.ndarray):
|
35 |
image = Image.fromarray(image)
|
|
|
4 |
from PIL import Image
|
5 |
import os
|
6 |
import numpy as np
|
7 |
+
import spaces
|
8 |
|
9 |
model = AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-large', trust_remote_code=True).to("cuda").eval()
|
10 |
processor = AutoProcessor.from_pretrained('microsoft/Florence-2-large', trust_remote_code=True)
|
|
|
29 |
|
30 |
return merged_content if merged_content != caption else caption
|
31 |
|
32 |
+
@spaces.GPU
|
33 |
def process_image(image):
|
34 |
if isinstance(image, np.ndarray):
|
35 |
image = Image.fromarray(image)
|