Sasiraj01 commited on
Commit
51f54e0
·
verified ·
1 Parent(s): 0678aa0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -50,15 +50,12 @@ logger = logging.getLogger(__name__)
50
  embeddings = OpenAIEmbeddings(openai_api_key=openai_api_key)
51
 
52
  # Load FAISS index with error handling
 
 
 
53
  # Load FAISS index with error handling
54
- faiss_index_path = "/Users/sasi/Downloads/Multimodal/faiss_index/index.faiss" # Path on Hugging Face Space
55
-
56
- try:
57
- db = FAISS.load_local(faiss_index_path, embeddings, allow_dangerous_deserialization=True)
58
- logger.info(f"FAISS index loaded successfully from {faiss_index_path}.")
59
- except Exception as e:
60
- logger.error(f"Error loading FAISS index from {faiss_index_path}: {e}")
61
- db = None # Avoid crashing
62
 
63
 
64
  # Define the prompt template
 
50
  embeddings = OpenAIEmbeddings(openai_api_key=openai_api_key)
51
 
52
  # Load FAISS index with error handling
53
+ app = FastAPI()
54
+ templates = Jinja2Templates(directory="templates")
55
+
56
  # Load FAISS index with error handling
57
+ db = FAISS.load_local("faiss_index", embeddings, allow_dangerous_deserialization=True)
58
+
 
 
 
 
 
 
59
 
60
 
61
  # Define the prompt template