HtSimple commited on
Commit
32b953e
·
verified ·
1 Parent(s): 394e93a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -187,8 +187,7 @@ def image_search(query_image, top_k=9, min_similarity=0.0):
187
 
188
  # 初始化向量数据库(保持不变)
189
  def initialize_vector_db():
190
- script_dir = os.path.dirname(os.path.abspath(__file__))
191
- root_dir = os.path.join(script_dir, 'GroceryStoreDataset')
192
  flag_file = os.path.join(root_dir, 'dataset', '.vectors_inserted')
193
  if os.path.exists(flag_file):
194
  print("发现标志文件,跳过向量数据库检查")
@@ -240,6 +239,7 @@ def initialize_vector_db():
240
 
241
  # 主应用界面
242
  def create_app():
 
243
  initialize_vector_db()
244
 
245
  with gr.Blocks(title="CLIP图像搜索系统", theme=gr.themes.Soft()) as app:
 
187
 
188
  # 初始化向量数据库(保持不变)
189
  def initialize_vector_db():
190
+ root_dir = os.path.join("/home/user/app", "GroceryStoreDataset") # Spaces 固定路径
 
191
  flag_file = os.path.join(root_dir, 'dataset', '.vectors_inserted')
192
  if os.path.exists(flag_file):
193
  print("发现标志文件,跳过向量数据库检查")
 
239
 
240
  # 主应用界面
241
  def create_app():
242
+ root_dir = os.path.join("/home/user/app", "GroceryStoreDataset") # Spaces 固定路径
243
  initialize_vector_db()
244
 
245
  with gr.Blocks(title="CLIP图像搜索系统", theme=gr.themes.Soft()) as app: