CoolFace
Apppublic

varun500/instructor

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
app.py22 linesDownload Raw Back to root
1import gradio as gr2from InstructorEmbedding import INSTRUCTOR3 4def represent_science_title(instruction, sentence):5    model = INSTRUCTOR('hkunlp/instructor-xl')6    embeddings = model.encode([[instruction, sentence]])7    print("Embeddings:", embeddings)8    return embeddings9 10title_representor = gr.Interface(11    fn=represent_science_title,12    inputs=[13        gr.inputs.Textbox(label="Instruction"),14        gr.inputs.Textbox(label="Sentence")15    ],16    outputs="text",17    title="Science Title Representation",18    description="Enter an instruction and a sentence to represent the science title using the Instructor model."19)20 21title_representor.launch()22