Spaces:
Build error
Build error
import gradio as gr | |
from InstructorEmbedding import INSTRUCTOR | |
def represent_science_title(instruction, sentence): | |
model = INSTRUCTOR('hkunlp/instructor-xl') | |
embeddings = model.encode([[instruction, sentence]]) | |
print("Embeddings:", embeddings) | |
return embeddings | |
title_representor = gr.Interface( | |
fn=represent_science_title, | |
inputs=[ | |
gr.inputs.Textbox(label="Instruction"), | |
gr.inputs.Textbox(label="Sentence") | |
], | |
outputs="text", | |
title="Science Title Representation", | |
description="Enter an instruction and a sentence to represent the science title using the Instructor model." | |
) | |
title_representor.launch() | |