0xalfroz commited on
Commit
d118cf4
1 Parent(s): 56518e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -8,7 +8,7 @@ model = AutoModel.from_pretrained(model_name)
8
  tokenizer = AutoTokenizer.from_pretrained(model_name)
9
 
10
  def text_to_vector(texts):
11
- # Tokenize and process a batch of inputs
12
  inputs = tokenizer(texts, return_tensors="pt", padding=True, truncation=True)
13
  outputs = model(**inputs)
14
  vectors = outputs.pooler_output.detach().numpy()
@@ -19,11 +19,12 @@ def text_to_vector(texts):
19
 
20
  demo = gr.Interface(
21
  fn=text_to_vector,
22
- inputs=gr.Textbox(label="Enter text", lines=4, placeholder="Enter one or more texts (separate with new lines)"),
23
  outputs=gr.Textbox(label="Text Vectors", lines=10),
24
  title="Batch Text to Vector",
25
- description="This demo converts a batch of texts to vectors."
26
  )
27
 
28
  demo.launch()
29
 
 
 
8
  tokenizer = AutoTokenizer.from_pretrained(model_name)
9
 
10
  def text_to_vector(texts):
11
+ # Expect texts to be an array of sentences
12
  inputs = tokenizer(texts, return_tensors="pt", padding=True, truncation=True)
13
  outputs = model(**inputs)
14
  vectors = outputs.pooler_output.detach().numpy()
 
19
 
20
  demo = gr.Interface(
21
  fn=text_to_vector,
22
+ inputs=gr.Textbox(label="Enter JSON array", placeholder="Enter an array of sentences as a JSON string"),
23
  outputs=gr.Textbox(label="Text Vectors", lines=10),
24
  title="Batch Text to Vector",
25
+ description="This demo converts an array of sentences to vectors."
26
  )
27
 
28
  demo.launch()
29
 
30
+