File size: 518 Bytes
28e2a5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from InstructorEmbedding import INSTRUCTOR

model = INSTRUCTOR('hkunlp/instructor-xl')

def create_embedding(instruction, sentence):
    embeddings = model.encode([[instruction, sentence]])
    print("Embeddings:", embeddings)
    return embeddings

instructor_model_embeddings = gr.Interface(
    fn=create_embedding,
    inputs=[
        gr.inputs.Textbox(label="Query_Instruction"),
        gr.inputs.Textbox(label="Query")
    ],
    outputs="text",
    title="API-Instructor-XL-1",
).launch()