Samizie's picture
Update app.py
dee1848 verified
raw
history blame contribute delete
634 Bytes
import gradio as gr
from langchain_huggingface import HuggingFaceEmbeddings
# Initialize embedding model
embedding_model = HuggingFaceEmbeddings(model_name="mixedbread-ai/mxbai-embed-large-v1")
# Function to generate embeddings
def embed_text(text):
return embedding_model.embed_query(text)
# Create Gradio Interface
iface = gr.Interface(
fn=embed_text,
inputs="text",
outputs="json",
title="Ollama Text Embeddings",
description="Enter text to get its embedding using Ollama and Hugging Face.",
)
# Launch the Gradio app
if __name__ == "__main__":
iface.launch(server_name="0.0.0.0", server_port=7860)