add
Browse files- app.py +5 -4
- requirements.txt +0 -1
app.py
CHANGED
@@ -37,10 +37,11 @@ def run_example(image, task, additional_text=""):
|
|
37 |
return "Please upload an image.", None
|
38 |
|
39 |
prompt = f"<{task}>"
|
40 |
-
if task == "CAPTION_TO_PHRASE_GROUNDING"
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
44 |
|
45 |
generated_ids = model.generate(
|
46 |
input_ids=inputs["input_ids"],
|
|
|
37 |
return "Please upload an image.", None
|
38 |
|
39 |
prompt = f"<{task}>"
|
40 |
+
if task == "CAPTION_TO_PHRASE_GROUNDING":
|
41 |
+
# For Caption to Phrase Grounding, we include the additional text in the prompt
|
42 |
+
prompt += f" {additional_text}"
|
43 |
+
|
44 |
+
inputs = processor(text=prompt, images=image, return_tensors="pt")
|
45 |
|
46 |
generated_ids = model.generate(
|
47 |
input_ids=inputs["input_ids"],
|
requirements.txt
CHANGED
@@ -4,5 +4,4 @@ Requests==2.32.3
|
|
4 |
transformers==4.43.3
|
5 |
torch
|
6 |
timm
|
7 |
-
flash_attn
|
8 |
einops
|
|
|
4 |
transformers==4.43.3
|
5 |
torch
|
6 |
timm
|
|
|
7 |
einops
|