Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
pipeline = pipeline("feature-extraction", model="WhereIsAI/UAE-Large-V1") | |
def similarity(text): | |
title_embedding = pipeline(text) | |
term_embedding = pipeline('multivitamin for men') | |
semantic_score = cosine_similarity(title_embedding.flatten(), term_embedding.flatten()) * 100 | |
return str(format(semantic_score,'.2f')) | |
gradio_app = gr.Interface( | |
predict, | |
inputs='text', | |
outputs='text', | |
title="Yes Or No?", | |
) | |
if __name__ == "__main__": | |
gradio_app.launch() |