Abhijit-192-168-1-1 commited on
Commit
498d36d
1 Parent(s): 77be9aa

modified app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -32,14 +32,14 @@ model = PeftModel.from_pretrained(model, "McGill-NLP/LLM2Vec-Sheared-LLaMA-mntp-
32
  # Wrapper for encoding and pooling operations
33
  l2v = LLM2Vec(model, tokenizer, pooling_mode="mean", max_length=512)
34
 
35
- def encode_text(input_text):
36
- encoding = l2v.encode(input_text)
37
- return encoding
38
 
39
  # Define Gradio interface
40
  iface = gr.Interface(
41
- fn=encode_text,
42
- inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
43
  outputs=gr.JSON()
44
  )
45
 
 
32
  # Wrapper for encoding and pooling operations
33
  l2v = LLM2Vec(model, tokenizer, pooling_mode="mean", max_length=512)
34
 
35
+ def encode_texts(input_texts):
36
+ encodings = [l2v.encode(text) for text in input_texts]
37
+ return encodings
38
 
39
  # Define Gradio interface
40
  iface = gr.Interface(
41
+ fn=encode_texts,
42
+ inputs=gr.Textbox(lines=5, placeholder="Enter texts separated by newlines..."),
43
  outputs=gr.JSON()
44
  )
45