Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,22 +17,22 @@ model = imagebind_model.imagebind_huge(pretrained=True)
|
|
17 |
model.eval()
|
18 |
model.to(device)
|
19 |
|
20 |
-
def image_text_zeroshot(
|
21 |
-
labels = [
|
22 |
-
inputs = {
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
with torch.no_grad():
|
27 |
-
|
28 |
-
|
29 |
-
# scores = (
|
30 |
-
# torch.softmax(
|
31 |
-
# embeddings[ModalityType.VISION] @ embeddings[ModalityType.TEXT].T, dim=-1
|
32 |
-
# )
|
33 |
-
# .squeeze(0)
|
34 |
-
# .tolist()
|
35 |
-
# )
|
36 |
|
37 |
score_dict = "./assets/ICA-Logo.png" #{label: score for label, score in zip(labels, scores)}
|
38 |
|
@@ -42,11 +42,14 @@ def image_text_zeroshot(texts):
|
|
42 |
def main():
|
43 |
|
44 |
iface = gr.Interface(
|
45 |
-
fn=
|
46 |
-
inputs
|
47 |
-
outputs
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
50 |
)
|
51 |
|
52 |
iface.launch()
|
|
|
17 |
model.eval()
|
18 |
model.to(device)
|
19 |
|
20 |
+
def image_text_zeroshot(text):
|
21 |
+
# labels = [text]
|
22 |
+
# inputs = {
|
23 |
+
# ModalityType.TEXT: data.load_and_transform_text(labels, device)
|
24 |
+
# }
|
25 |
+
|
26 |
+
# with torch.no_grad():
|
27 |
+
# embeddings = model(inputs)
|
28 |
+
|
29 |
+
# # scores = (
|
30 |
+
# # torch.softmax(
|
31 |
+
# # embeddings[ModalityType.VISION] @ embeddings[ModalityType.TEXT].T, dim=-1
|
32 |
+
# # )
|
33 |
+
# # .squeeze(0)
|
34 |
+
# # .tolist()
|
35 |
+
# # )
|
36 |
|
37 |
score_dict = "./assets/ICA-Logo.png" #{label: score for label, score in zip(labels, scores)}
|
38 |
|
|
|
42 |
def main():
|
43 |
|
44 |
iface = gr.Interface(
|
45 |
+
fn=image_text_zeroshot,
|
46 |
+
inputs="text",
|
47 |
+
outputs="file",
|
48 |
+
live=True,
|
49 |
+
capture_session=True,
|
50 |
+
title="Texto para Imagem",
|
51 |
+
description="Digite um texto e obtenha uma imagem com o texto.",
|
52 |
+
allow_flagging=False,
|
53 |
)
|
54 |
|
55 |
iface.launch()
|