codeblacks commited on
Commit
ff7c210
·
verified ·
1 Parent(s): 18feec4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -5,6 +5,7 @@ import torch
5
  # Load the pre-trained model
6
  embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
7
 
 
8
  def get_embeddings(sentences):
9
  embeddings = model.encode(sentences, convert_to_tensor=True)
10
  return embeddings.tolist()
@@ -13,10 +14,11 @@ def get_embeddings(sentences):
13
  interface = gr.Interface(
14
  fn=get_embeddings, # Function to call
15
  inputs=gr.Textbox(lines=2, placeholder="Enter sentences here, one per line"), # Input component
16
- outputs=gr.Image(label="Embeddings", image_formatter=plot_embeddings)
 
17
  title="Sentence Embeddings", # Interface title
18
  description="Enter sentences to get their embeddings." # Description
19
  )
20
 
21
  # Launch the interface
22
- interface.launch()
 
5
  # Load the pre-trained model
6
  embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
7
 
8
+
9
  def get_embeddings(sentences):
10
  embeddings = model.encode(sentences, convert_to_tensor=True)
11
  return embeddings.tolist()
 
14
  interface = gr.Interface(
15
  fn=get_embeddings, # Function to call
16
  inputs=gr.Textbox(lines=2, placeholder="Enter sentences here, one per line"), # Input component
17
+ # outputs=gr.JSON(),
18
+ outputs=gr.Textbox(label="Embeddings"),
19
  title="Sentence Embeddings", # Interface title
20
  description="Enter sentences to get their embeddings." # Description
21
  )
22
 
23
  # Launch the interface
24
+ interface.launch()