Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ import faiss
|
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
import time
|
| 9 |
import sys
|
|
|
|
| 10 |
|
| 11 |
# 创建安全缓存目录
|
| 12 |
CACHE_DIR = "/home/user/cache"
|
|
@@ -114,7 +115,9 @@ def predict(vector):
|
|
| 114 |
results.append(f"结果 {i+1}: 数据获取失败")
|
| 115 |
|
| 116 |
print(f"处理完成 | 耗时: {time.time()-start_time:.2f}秒")
|
| 117 |
-
return
|
|
|
|
|
|
|
| 118 |
|
| 119 |
except Exception as e:
|
| 120 |
import traceback
|
|
|
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
import time
|
| 9 |
import sys
|
| 10 |
+
import json
|
| 11 |
|
| 12 |
# 创建安全缓存目录
|
| 13 |
CACHE_DIR = "/home/user/cache"
|
|
|
|
| 115 |
results.append(f"结果 {i+1}: 数据获取失败")
|
| 116 |
|
| 117 |
print(f"处理完成 | 耗时: {time.time()-start_time:.2f}秒")
|
| 118 |
+
return json.dumps({
|
| 119 |
+
"results": results # 确保嵌套结构合法
|
| 120 |
+
})
|
| 121 |
|
| 122 |
except Exception as e:
|
| 123 |
import traceback
|