Spaces:
Runtime error
Runtime error
Update app.py
Browse files2 unmodified lines3456782 unmodified linesfrom llama_index.core import VectorStoreIndex, SimpleDirectoryReader, ServiceContextfrom llama_index.embeddings.huggingface import HuggingFaceEmbedding# ✅ Use Hugging Face embedding modelembed_model = HuggingFaceEmbedding(model_name="sentence-transformers/all-MiniLM-L6-v2")service_context = ServiceContext.from_defaults(embed_model=embed_model)2 unmodified lines345678910111213141516172 unmodified linesfrom llama_index.core import VectorStoreIndex, SimpleDirectoryReader, ServiceContextfrom llama_index.embeddings.huggingface import HuggingFaceEmbedding# Access from Hugging Face secretopenai_api_key = os.environ.get("OPENAI_API_KEY")if openai_api_key:os.environ["OPENAI_API_KEY"] = openai_api_key # optional if your library reads it directlyelse:raise ValueError("❌ OPENAI_API_KEY not found. Add it in Space settings > Secrets.")# ✅ Use Hugging Face embedding modelembed_model = HuggingFaceEmbedding(model_name="sentence-transformers/all-MiniLM-L6-v2")service_context = ServiceContext.from_defaults(embed_model=embed_model)
app.py+9