awinml commited on
Commit
0280d96
1 Parent(s): b1c2058
Files changed (2) hide show
  1. app.py +19 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from InstructorEmbedding import INSTRUCTOR
3
+
4
+ model = INSTRUCTOR('hkunlp/instructor-xl')
5
+
6
+ def create_embedding(instruction, sentence):
7
+ embeddings = model.encode([[instruction, sentence]])
8
+ print("Embeddings:", embeddings)
9
+ return embeddings
10
+
11
+ instructor_model_embeddings = gr.Interface(
12
+ fn=create_embedding,
13
+ inputs=[
14
+ gr.inputs.Textbox(label="Query_Instruction"),
15
+ gr.inputs.Textbox(label="Query")
16
+ ],
17
+ outputs="text",
18
+ title="API-Instructor-XL-1",
19
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ InstructorEmbedding
2
+ sentence_transformers