File size: 595 Bytes
0280d96
e69943f
0280d96
 
 
 
2712bbe
b84637f
6bca98e
b84637f
0280d96
 
 
 
 
 
 
6fb12dd
0280d96
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
import numpy as np
from InstructorEmbedding import INSTRUCTOR

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

def create_embedding(query_instruction, query):
    embeddings = model.encode([[query_instruction, query]])
    embeddings_array = np.array(embeddings)
    return embeddings_array

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