Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,6 +33,20 @@ hf_token = os.getenv("HF_TOKEN")
|
|
| 33 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 34 |
OPENAI_BASE_URL = os.getenv("OPENAI_BASE_URL")
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
client = OpenAI(http_client=httpx.Client())
|
| 37 |
|
| 38 |
# Define the embedding model and the vectorstore
|
|
|
|
| 33 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 34 |
OPENAI_BASE_URL = os.getenv("OPENAI_BASE_URL")
|
| 35 |
|
| 36 |
+
import zipfile
|
| 37 |
+
|
| 38 |
+
# Define correct paths
|
| 39 |
+
zip_path = "reports_db.zip"
|
| 40 |
+
unzip_path = "reports_db"
|
| 41 |
+
|
| 42 |
+
# Extract if not already extracted
|
| 43 |
+
if not os.path.exists(unzip_path):
|
| 44 |
+
with zipfile.ZipFile(zip_path, "r") as zip_ref:
|
| 45 |
+
zip_ref.extractall(unzip_path)
|
| 46 |
+
|
| 47 |
+
# Now, set the persisted location correctly
|
| 48 |
+
persisted_vectordb_location = unzip_path
|
| 49 |
+
|
| 50 |
client = OpenAI(http_client=httpx.Client())
|
| 51 |
|
| 52 |
# Define the embedding model and the vectorstore
|