Spaces:
Sleeping
Sleeping
Download app.py from jackenmail/rag-embedder-app: direct link, hf CLI and curl.
- Browser
- Download file 616 Bytes
-
https://huggingface.co/spaces/jackenmail/rag-embedder-app/resolve/main/app.py
- Command line
-
hf download hf://spaces/jackenmail/rag-embedder-app/app.py
-
curl -L -o app.py https://huggingface.co/spaces/jackenmail/rag-embedder-app/resolve/main/app.py
616 Bytes
| # app.py | |
| import gradio as gr | |
| from sentence_transformers import SentenceTransformer | |
| import os | |
| MODEL_NAME = "jackenmail/rag-embedder" # 👈 Your trained model | |
| print(f"Loading model: {MODEL_NAME}") | |
| model = SentenceTransformer(MODEL_NAME) | |
| print("Model ready!") | |
| def embed(text: str): | |
| if not text.strip(): | |
| return [] | |
| return model.encode(text).tolist() | |
| demo = gr.Interface( | |
| fn = embed, | |
| inputs = gr.Textbox(label="Input Text"), | |
| outputs = gr.JSON(label="Embedding Vector"), | |
| title = "RAG Embedder API", | |
| description = f"Powered by {MODEL_NAME}" | |
| ) | |
| demo.launch() |