gschurck commited on
Commit
47e8579
·
1 Parent(s): 15471a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -11,9 +11,11 @@ def get_image_embedding(image):
11
  def get_text_embedding(text):
12
  multilingual_text_model = SentenceTransformer('clip-ViT-B-32-multilingual-v1')
13
  text_emb = multilingual_text_model.encode(text)
 
 
14
  return {"embedding": text_emb.tolist()}
15
 
16
- image_embedding = gr.Interface(fn=get_image_embedding, inputs=gr.Image(type="str"), outputs=gr.JSON(api_name="image-embedding"), title="Image Embedding")
17
  text_embedding = gr.Interface(fn=get_text_embedding, inputs=gr.Textbox(), outputs=gr.JSON(api_name="text-embedding"), title="Text Embedding")
18
 
19
  space = gr.TabbedInterface([image_embedding, text_embedding], ["Image Embedding", "Text Embedding"])
 
11
  def get_text_embedding(text):
12
  multilingual_text_model = SentenceTransformer('clip-ViT-B-32-multilingual-v1')
13
  text_emb = multilingual_text_model.encode(text)
14
+ print(text_emb)
15
+ print(text_emb.shape)
16
  return {"embedding": text_emb.tolist()}
17
 
18
+ image_embedding = gr.Interface(fn=get_image_embedding, inputs=gr.Image(type="filepath"), outputs=gr.JSON(api_name="image-embedding"), title="Image Embedding")
19
  text_embedding = gr.Interface(fn=get_text_embedding, inputs=gr.Textbox(), outputs=gr.JSON(api_name="text-embedding"), title="Text Embedding")
20
 
21
  space = gr.TabbedInterface([image_embedding, text_embedding], ["Image Embedding", "Text Embedding"])