doggdad commited on
Commit
2b0d8c8
·
verified ·
1 Parent(s): 01267a7

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +28 -1
src/app.py CHANGED
@@ -24,7 +24,10 @@ from langchain_core.runnables import (
24
  )
25
  from PIL import Image
26
  import lancedb
27
-
 
 
 
28
  # -------------------------------
29
  # 1. Setup - HuggingFace Spaces Configuration
30
  # -------------------------------
@@ -51,6 +54,30 @@ TBL_NAME = "vectorstore"
51
  db = lancedb.connect(LANCEDB_HOST_FILE)
52
  embedder = BridgeTowerEmbeddings()
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  # -------------------------------
55
  # 2. Preprocessing + Storage
56
  # -------------------------------
 
24
  )
25
  from PIL import Image
26
  import lancedb
27
+ import ssl
28
+ import socket
29
+ import subprocess
30
+ import sys
31
  # -------------------------------
32
  # 1. Setup - HuggingFace Spaces Configuration
33
  # -------------------------------
 
54
  db = lancedb.connect(LANCEDB_HOST_FILE)
55
  embedder = BridgeTowerEmbeddings()
56
 
57
+
58
+ # Fix DNS resolution issues in containerized environments
59
+ def fix_dns_resolution():
60
+ """Configure DNS settings for containerized environments"""
61
+ try:
62
+ # Set DNS servers
63
+ import os
64
+ os.environ['PYTHONHTTPSVERIFY'] = '0'
65
+
66
+ # Create unverified SSL context
67
+ ssl._create_default_https_context = ssl._create_unverified_context
68
+
69
+ # Set socket timeout
70
+ socket.setdefaulttimeout(30)
71
+
72
+ except Exception as e:
73
+ print(f"DNS fix warning: {e}")
74
+
75
+ # Call the fix before any downloads
76
+ fix_dns_resolution()
77
+
78
+
79
+
80
+
81
  # -------------------------------
82
  # 2. Preprocessing + Storage
83
  # -------------------------------