momergul
commited on
Commit
·
c1f8aba
1
Parent(s):
695707a
Update
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ def get_model_response(
|
|
40 |
model, adapter_name, processor, index_to_token, role: str,
|
41 |
image_paths: List[str], user_message: str = "", target_image: str = ""
|
42 |
) -> str:
|
43 |
-
|
44 |
if role == "speaker":
|
45 |
img_dir = "tangram_pngs"
|
46 |
print("Starting processing")
|
@@ -69,7 +69,7 @@ def get_model_response(
|
|
69 |
|
70 |
return response
|
71 |
|
72 |
-
@spaces.GPU(duration=
|
73 |
def get_speaker_response(model, images, input_tokens, attn_mask, image_attn_mask, label, image_paths, processor, img_dir, index_to_token):
|
74 |
model = model.cuda()
|
75 |
with torch.no_grad():
|
@@ -81,7 +81,7 @@ def get_speaker_response(model, images, input_tokens, attn_mask, image_attn_mask
|
|
81 |
)
|
82 |
return captions
|
83 |
|
84 |
-
@spaces.GPU(duration=
|
85 |
def get_listener_response(model, images, l_input_tokens, l_attn_mask, l_image_attn_mask, index_to_token,
|
86 |
s_input_tokens, s_attn_mask, s_image_attn_mask, s_target_mask, s_target_label, image_paths):
|
87 |
model = model.cuda()
|
|
|
40 |
model, adapter_name, processor, index_to_token, role: str,
|
41 |
image_paths: List[str], user_message: str = "", target_image: str = ""
|
42 |
) -> str:
|
43 |
+
model.model.set_adapter(adapter_name)
|
44 |
if role == "speaker":
|
45 |
img_dir = "tangram_pngs"
|
46 |
print("Starting processing")
|
|
|
69 |
|
70 |
return response
|
71 |
|
72 |
+
@spaces.GPU(duration=20)
|
73 |
def get_speaker_response(model, images, input_tokens, attn_mask, image_attn_mask, label, image_paths, processor, img_dir, index_to_token):
|
74 |
model = model.cuda()
|
75 |
with torch.no_grad():
|
|
|
81 |
)
|
82 |
return captions
|
83 |
|
84 |
+
@spaces.GPU(duration=20)
|
85 |
def get_listener_response(model, images, l_input_tokens, l_attn_mask, l_image_attn_mask, index_to_token,
|
86 |
s_input_tokens, s_attn_mask, s_image_attn_mask, s_target_mask, s_target_label, image_paths):
|
87 |
model = model.cuda()
|