Spaces:
Running
on
L4
Running
on
L4
Update app.py
Browse files
app.py
CHANGED
@@ -42,6 +42,7 @@ def fig_to_pil(fig):
|
|
42 |
model_id='microsoft/Florence-2-large'
|
43 |
model = models[model_id]
|
44 |
processor = processors[model_id]
|
|
|
45 |
|
46 |
@spaces.GPU
|
47 |
def run_example(task_prompt, image, text_input=None, model_id='microsoft/Florence-2-large'):
|
@@ -49,7 +50,7 @@ def run_example(task_prompt, image, text_input=None, model_id='microsoft/Florenc
|
|
49 |
prompt = task_prompt
|
50 |
else:
|
51 |
prompt = task_prompt + text_input
|
52 |
-
inputs = processor(text=prompt, images=image, return_tensors="pt")
|
53 |
generated_ids = model.generate(
|
54 |
input_ids=inputs["input_ids"],
|
55 |
pixel_values=inputs["pixel_values"],
|
|
|
42 |
model_id='microsoft/Florence-2-large'
|
43 |
model = models[model_id]
|
44 |
processor = processors[model_id]
|
45 |
+
processor.to("cuda")
|
46 |
|
47 |
@spaces.GPU
|
48 |
def run_example(task_prompt, image, text_input=None, model_id='microsoft/Florence-2-large'):
|
|
|
50 |
prompt = task_prompt
|
51 |
else:
|
52 |
prompt = task_prompt + text_input
|
53 |
+
inputs = processor(text=prompt, images=image, return_tensors="pt")
|
54 |
generated_ids = model.generate(
|
55 |
input_ids=inputs["input_ids"],
|
56 |
pixel_values=inputs["pixel_values"],
|