Spaces:
Runtime error
Runtime error
test
Browse files- app.py +17 -43
- assets/image_features_norm.pkl +3 -0
app.py
CHANGED
|
@@ -17,47 +17,21 @@ model = imagebind_model.imagebind_huge(pretrained=True)
|
|
| 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 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 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()
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
# def image_classifier(inp):
|
| 60 |
-
# return {'cat': 0.3, 'dog': 0.7}
|
| 61 |
-
|
| 62 |
-
# demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label")
|
| 63 |
-
# demo.launch()
|
|
|
|
| 17 |
model.eval()
|
| 18 |
model.to(device)
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
def generate_image(text):
|
| 22 |
+
return "./assets/ICA-Logo.png"
|
| 23 |
+
|
| 24 |
+
# Interface do Gradio
|
| 25 |
+
iface = gr.Interface(
|
| 26 |
+
fn=generate_image,
|
| 27 |
+
inputs="text",
|
| 28 |
+
outputs="file",
|
| 29 |
+
live=True,
|
| 30 |
+
capture_session=True,
|
| 31 |
+
title="Texto para Imagem",
|
| 32 |
+
description="Digite um texto e obtenha uma imagem com o texto.",
|
| 33 |
+
allow_flagging=False,
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
# Executa o servidor Gradio
|
| 37 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/image_features_norm.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e03967fc728ee9d3c0ded40f39aaac85360cd7acf6efc18f722b47b7d7187fd9
|
| 3 |
+
size 33175
|