Spaces:
Sleeping
Sleeping
Upload 2 files (#4)
Browse files- Upload 2 files (287764b42e330781d8176e4ffd848302d09fbeac)
- app.py +4 -3
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from InstructorEmbedding import INSTRUCTOR
|
3 |
|
4 |
model = INSTRUCTOR('hkunlp/instructor-xl')
|
5 |
|
6 |
def create_embedding(query_instruction, query):
|
7 |
-
embeddings = model.encode([[query_instruction, query]]).tolist()
|
8 |
-
|
9 |
return embeddings
|
10 |
|
11 |
instructor_model_embeddings = gr.Interface(
|
@@ -14,6 +15,6 @@ instructor_model_embeddings = gr.Interface(
|
|
14 |
gr.inputs.Textbox(label="Query_Instruction"),
|
15 |
gr.inputs.Textbox(label="Query")
|
16 |
],
|
17 |
-
outputs="
|
18 |
title="API-Instructor-XL-1",
|
19 |
).launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
from InstructorEmbedding import INSTRUCTOR
|
4 |
|
5 |
model = INSTRUCTOR('hkunlp/instructor-xl')
|
6 |
|
7 |
def create_embedding(query_instruction, query):
|
8 |
+
embeddings = model.encode([[query_instruction, query]])[0].tolist()
|
9 |
+
#embeddings_array = np.array(embeddings)
|
10 |
return embeddings
|
11 |
|
12 |
instructor_model_embeddings = gr.Interface(
|
|
|
15 |
gr.inputs.Textbox(label="Query_Instruction"),
|
16 |
gr.inputs.Textbox(label="Query")
|
17 |
],
|
18 |
+
outputs="list",
|
19 |
title="API-Instructor-XL-1",
|
20 |
).launch()
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
|
|
1 |
InstructorEmbedding
|
2 |
-
sentence_transformers
|
|
|
1 |
+
numpy
|
2 |
InstructorEmbedding
|
3 |
+
sentence_transformers
|