Commit 8058a38d by unknown

add image url post

parent 052f0308
...@@ -22,7 +22,7 @@ conda虚拟环境:conda activate search_book ...@@ -22,7 +22,7 @@ conda虚拟环境:conda activate search_book
准备工作: 准备工作:
1、将习题图书拆分为整页整页的完整图片,并使用合合OCR解析整页图片,放入excel的page_ocr列。 1、将习题图书拆分为整页整页的完整图片,并使用合合OCR解析整页图片,放入excel的page_ocr列。
2、将习题图书拆分为一个个独立的题目图片,并使用合合OCR解析题目图片,将ocr结果放入question_ocr列。将题目图片和题目合合eOCR结果一起输入豆包embedding模型"doubao-embedding-vision-250615"得到一个1024维的向量,处理为json字符串后放入excel的“question_image_embedding”列里。 2、将习题图书拆分为一个个独立的题目图片,并使用合合OCR解析题目图片,将ocr结果放入question_ocr列。将题目图片和题目合合eOCR结果一起输入豆包embedding模型"doubao-embedding-vision-250615"得到一个1024维的向量,处理为json字符串后放入excel的“question_image_embedding”列里。
3、后端将以上excel数据通过接口插入es数据库(excel文档样例:“12668836-2025.xlsx”),在原有拆书平台下载的excel文档中添加【question_ocr(题目的ocr结果),source_image_url(整页图片url),page_ocr(整页图片ocr),question_image_embedding(题目ocr和题目原图的向量)】列 3、后端将以上excel数据通过接口插入es数据库(excel文档样例:12668836-2025.xlsx)
搜整页图片流程: 搜整页图片流程:
...@@ -108,7 +108,6 @@ delete_es_book(book_id) ...@@ -108,7 +108,6 @@ delete_es_book(book_id)
# 3、搜整页图片接口 # 3、搜整页图片接口
def search_book_question(book_id, image_ocr): def search_book_question(book_id, image_ocr):
# 3、搜书搜题
url = 'http://localhost:31001/search_page' url = 'http://localhost:31001/search_page'
url = 'http://61.170.32.8:31001/search_page' url = 'http://61.170.32.8:31001/search_page'
headers = { headers = {
...@@ -142,8 +141,6 @@ print(res) ...@@ -142,8 +141,6 @@ print(res)
#### 4、搜题接口 (只用题目合合OCR结果) #### 4、搜题接口 (只用题目合合OCR结果)
``` ```
# 4、搜题(只用题目paddleOCR结果)接口
def search_question_text(book_id, question_ocr): def search_question_text(book_id, question_ocr):
url = 'http://localhost:31001/search_question_text' url = 'http://localhost:31001/search_question_text'
# url = 'http://61.170.32.8:31001/search_question_text' # url = 'http://61.170.32.8:31001/search_question_text'
...@@ -178,9 +175,7 @@ search_question_text(book_id, question_ocr) ...@@ -178,9 +175,7 @@ search_question_text(book_id, question_ocr)
#### 5、搜题接口 (题目合合ocr和题目图片作为一个整体的向量) #### 5、搜题接口 (题目合合ocr和题目图片作为一个整体的向量)
``` ```
# 5、搜题接口 (题目合合ocr和题目图片作为一个整体的向量) def search_question_embedding(book_id:str, question_embedding:str):
def search_question_embedding(book_id:str, question_embedding):
url = 'http://localhost:31001/search_question_embedding' url = 'http://localhost:31001/search_question_embedding'
# url = 'http://61.170.32.8:31001/search_question_embedding' # url = 'http://61.170.32.8:31001/search_question_embedding'
headers = { headers = {
...@@ -190,7 +185,7 @@ def search_question_embedding(book_id:str, question_embedding): ...@@ -190,7 +185,7 @@ def search_question_embedding(book_id:str, question_embedding):
# 表单数据 # 表单数据
data = { data = {
"book_id": book_id, "book_id": book_id,
"question_embedding": question_embedding, "question_embedding": question_embedding, # 1024维
"top_k": 1 "top_k": 1
} }
data = json.dumps(data, ensure_ascii=False) data = json.dumps(data, ensure_ascii=False)
...@@ -214,6 +209,42 @@ res=search_question_embedding(book_id, question_embedding) ...@@ -214,6 +209,42 @@ res=search_question_embedding(book_id, question_embedding)
#### 6、搜题接口 (输入题目图片合合ocr和题目图片url链接)
```
def search_question_embedding2(book_id, question_image_url, question_image_ocr):
url = 'http://localhost:31001/search_question_embedding'
url = 'http://61.170.32.8:31001/search_question_embedding'
headers = {
'accept': 'application/json',
}
# 表单数据
data = {
"book_id": book_id,
"question_image_url": question_image_url,
"question_image_ocr": question_image_ocr,
"top_k": 1
}
data = json.dumps(data, ensure_ascii=False)
response = requests.post(url, headers=headers, data=data )
# 输出响应结果
print(f"状态码: {response.status_code}")
res = response.json()
bankId = res['es_search'][0]['_source']['bankId']
print("bankId: ", bankId)
res = json.dumps(res, ensure_ascii=False, indent=4)
return res
book_id = "12670279"
question_image_ocr = "题目图片的合合ocr结果"
question_image_url = "https://example.123.jpg"
res=search_question_embedding(book_id, question_image_url, question_image_ocr)
```
#### 6、启动服务 #### 6、启动服务
```linux ```linux
......
...@@ -5,7 +5,7 @@ from pathlib import Path ...@@ -5,7 +5,7 @@ from pathlib import Path
from pydantic import BaseModel from pydantic import BaseModel
import uvicorn import uvicorn
import logging import logging
from tools import doubao_image_embedding
from save_es_database import EsHelper from save_es_database import EsHelper
from prepare_data import prepareData from prepare_data import prepareData
...@@ -51,7 +51,9 @@ class SearchQuestionText(BaseModel): ...@@ -51,7 +51,9 @@ class SearchQuestionText(BaseModel):
# 搜题目请求数据结构(仅输入题目图片的向量) # 搜题目请求数据结构(仅输入题目图片的向量)
class SearchQuestionEmbedding(BaseModel): class SearchQuestionEmbedding(BaseModel):
book_id: str book_id: str
question_embedding: str # 题目的图片的embedding ; json.dumps([]) question_image_url: str = None # 题目图片的url链接
question_image_ocr: str = None # 题目图片的合合ocr结果
question_embedding: str = None # 题目图片和合合ocr文本的豆包1024维向量
top_k: int = 1 top_k: int = 1
# 搜题目请求数据结构(输入题目图片的向量 和题目图片的OCR结果) # 搜题目请求数据结构(输入题目图片的向量 和题目图片的OCR结果)
...@@ -225,37 +227,35 @@ async def search_question_text(input: SearchQuestionText): ...@@ -225,37 +227,35 @@ async def search_question_text(input: SearchQuestionText):
# 4、搜图中的某个题目(只使用题目图片和ocr的向量) # 4、搜图中的某个题目(只使用题目图片和ocr的向量)
@app.post("/search_question_embedding") @app.post("/search_question_embedding")
async def search_question_embedding(input: SearchQuestionEmbedding): async def search_question_embedding(input: SearchQuestionEmbedding):
logger_es.info(f"search_question_embedding : book_id: {input.book_id}") logger_es.info(f"search_question_embedding : {input}")
book_id = input.book_id book_id = input.book_id
question_embedding = input.question_embedding question_image_url = input.question_image_url
question_image_ocr = input.question_image_ocr
top_k = input.top_k top_k = input.top_k
try:
question_embedding = json.loads(question_embedding)
res = await es.search_question_embedding(index_name, book_id, question_embedding, top_k)
except Exception as e:
logger_es.info(f"search_question_embedding : 搜索 book_id:{book_id},出错:{e}。")
raise HTTPException(status_code=500, detail=f"search_question_embedding 接口 book_id:{book_id},出错:{e}。")
return {"status": "success", "es_search": res}
# 5、搜图中某个题目(联合文本搜索和向量搜索)
@app.post("/search_question_text_and_embedding")
async def search_question_text_and_embedding(input: SearchQuestionTextAndEmbedding):
logger_es.info(f"search_question_text_and_embedding : {input.book_id}")
book_id = input.book_id
question_ocr = input.question_ocr
question_embedding = input.question_embedding question_embedding = input.question_embedding
top_k = input.top_k if not question_embedding and question_image_url and question_image_ocr:
try:
question_embedding = doubao_image_embedding(question_image_url, question_image_ocr) # 豆包大模型做图片和文本的向量1024维向量
except Exception as e:
logger_es.info(f"search_question_embedding : {input},豆包embedding error :{e}。")
raise HTTPException(status_code=510, detail=f"search_question_embedding: 豆包embedding error: {e}。")
try: try:
question_embedding = json.loads(question_embedding) res = await es.search_question_embedding(index_name, book_id, question_embedding, top_k)
res = await es.search_question_textAndEmbedding(index_name, book_id, question_ocr, question_embedding, top_k) except Exception as e:
except Exception as e: logger_es.info(f"search_question_embedding : 搜索 book_id:{book_id},出错:{e}。")
logger_es.info(f"search_question_text_and_embedding : 搜索 book_id:{book_id},出错:{e}。") raise HTTPException(status_code=500, detail=f"search_question_embedding 接口 book_id:{book_id},出错:{e}。")
raise HTTPException(status_code=500, detail=f"search_question_text_and_embedding 接口 book_id:{book_id},出错:{e}。")
elif question_embedding:
try:
question_embedding = json.loads(question_embedding)
res = await es.search_question_embedding(index_name, book_id, question_embedding, top_k)
except Exception as e:
logger_es.info(f"search_question_embedding : 搜索 book_id:{book_id},出错:{e}。")
raise HTTPException(status_code=500, detail=f"search_question_embedding 接口 book_id:{book_id},出错:{e}。")
else:
raise HTTPException(status_code=520, detail=f"the question_image_url must be efficient")
return {"status": "success", "es_search": res} return {"status": "success", "es_search": res}
......
...@@ -139,6 +139,33 @@ def search_question_embedding(book_id, question_embedding): ...@@ -139,6 +139,33 @@ def search_question_embedding(book_id, question_embedding):
res = json.dumps(res, ensure_ascii=False, indent=4) res = json.dumps(res, ensure_ascii=False, indent=4)
return res return res
def search_question_embedding2(book_id, question_image_url, question_image_ocr):
# 4、搜题(只用题目的ocr和图片的embedding数据)
url = 'http://localhost:31001/search_question_embedding'
url = 'http://61.170.32.8:31001/search_question_embedding'
headers = {
'accept': 'application/json',
}
# 表单数据
data = {
"book_id": book_id,
"question_image_url": question_image_url,
"question_image_ocr": question_image_ocr,
"top_k": 1
}
data = json.dumps(data, ensure_ascii=False)
response = requests.post(url, headers=headers, data=data )
# 输出响应结果
print(f"状态码: {response.status_code}")
res = response.json()
bankId = res['es_search'][0]['_source']['bankId']
print("bankId: ", bankId)
res = json.dumps(res, ensure_ascii=False, indent=4)
return res
def search_question_text_and_embedding(book_id, question_ocr, question_embedding): def search_question_text_and_embedding(book_id, question_ocr, question_embedding):
# 5、搜题(使用题目ocr的文本搜题,再使用题目ocr和图片整体的向量搜题,联合两个搜索的得分) # 5、搜题(使用题目ocr的文本搜题,再使用题目ocr和图片整体的向量搜题,联合两个搜索的得分)
url = 'http://localhost:31001/search_question_text_and_embedding' url = 'http://localhost:31001/search_question_text_and_embedding'
...@@ -183,18 +210,18 @@ if __name__ == "__main__": ...@@ -183,18 +210,18 @@ if __name__ == "__main__":
# print("\n1、es中插入excel数据") # print("\n1、es中插入excel数据")
# insert_excel(data) # insert_excel(data)
# 1.2、插入整个文件夹的数据进入es # # 1.2、插入整个文件夹的数据进入es
path_dir = "/home/liuxin/work/search_question/data/拆书平台下载excel文件_添加字段内容" # path_dir = "/home/liuxin/work/search_question/data/拆书平台下载excel文件_添加字段内容"
file_names = os.listdir(path_dir) # file_names = os.listdir(path_dir)
file_names = [file_name for file_name in file_names if file_name.endswith(".xlsx")] # file_names = [file_name for file_name in file_names if file_name.endswith(".xlsx")]
print(f"文件夹 {path_dir} 共{len(file_names)}个excel文件") # print(f"文件夹 {path_dir} 共{len(file_names)}个excel文件")
file_names = [file_name for file_name in file_names if "-" in file_name] # file_names = [file_name for file_name in file_names if "-" in file_name]
print(f"文件夹 {path_dir} 共{len(file_names)}个excel文件") # print(f"文件夹 {path_dir} 共{len(file_names)}个excel文件")
book_ids = [file_name.split("-")[0] for file_name in file_names ] # book_ids = [file_name.split("-")[0] for file_name in file_names ]
for book_id, file_name in zip(book_ids, file_names): # for book_id, file_name in zip(book_ids, file_names):
file = os.path.join(path_dir, file_name) # file = os.path.join(path_dir, file_name)
input = {"book_id":book_id, "book_name":file_name[:-5], "file_path":file} # input = {"book_id":book_id, "book_name":file_name[:-5], "file_path":file}
insert_excel(input) # insert_excel(input)
# # 2、指定 book_id 删除es中对应的数据 # # 2、指定 book_id 删除es中对应的数据
# print("\n2、指定 book_id 删除es中对应的数据") # print("\n2、指定 book_id 删除es中对应的数据")
...@@ -220,7 +247,7 @@ if __name__ == "__main__": ...@@ -220,7 +247,7 @@ if __name__ == "__main__":
# res = search_question_text(book_id, question_ocr, image_ocr=image_ocr) # res = search_question_text(book_id, question_ocr, image_ocr=image_ocr)
# print(res) # print(res)
# 5、搜题 只搜索题目向量 # 5、搜题 只搜索题目向量(直接输入1024维的向量)
print("\n5、搜题 只搜索题目向量") print("\n5、搜题 只搜索题目向量")
book_id = "12667382" book_id = "12667382"
question_embedding = [ question_embedding = [
...@@ -1253,1040 +1280,13 @@ if __name__ == "__main__": ...@@ -1253,1040 +1280,13 @@ if __name__ == "__main__":
# res = search_question_embedding(book_id, question_embedding) # res = search_question_embedding(book_id, question_embedding)
# print(res) # print(res)
# 6、搜题 只搜索题目向量(输入图片url和图片合合ocr)
# 6、搜题 只搜索题目向量 print("\n6、搜题 只搜索题目向量")
print("\n6、搜题 搜索题目向量和题目ocr文本,联合打分")
book_id = "12667382" book_id = "12667382"
question_embedding = [ question_image_url = "https://oss.5rs.me/oss/upload/image/jpeg/cc008bc80c6d4dceab49dc8d69603c58.jpeg"
0.00543212890625, question_image_ocr = "道家 儒家 墨家"
-0.005035400390625, res = search_question_embedding2(book_id, question_image_url, question_image_ocr)
0.00714111328125, print(res)
0.06591796875,
-0.032958984375,
-0.0380859375,
-0.0255126953125,
-0.046630859375,
0.01031494140625,
0.036376953125,
0.013916015625,
0.0255126953125,
-0.0107421875,
-0.04345703125,
0.0008697509765625,
0.02587890625,
-0.0201416015625,
-0.02099609375,
-0.00830078125,
0.033203125,
-0.01007080078125,
0.0224609375,
-0.04931640625,
0.0206298828125,
0.009765625,
0.02392578125,
0.00095367431640625,
0.03369140625,
0.005035400390625,
0.07373046875,
0.0262451171875,
0.015625,
-0.021728515625,
0.0054931640625,
0.0308837890625,
0.055419921875,
-0.0517578125,
0.011474609375,
-0.023681640625,
0.0235595703125,
-0.00128173828125,
0.0096435546875,
0.003936767578125,
-0.01953125,
-0.05126953125,
0.001617431640625,
-0.005218505859375,
-0.01409912109375,
-0.026611328125,
0.0198974609375,
0.02001953125,
0.004974365234375,
0.053955078125,
-0.0634765625,
-0.0654296875,
-0.03369140625,
-0.08154296875,
0.06005859375,
0.0223388671875,
-0.044921875,
-0.0283203125,
0.01483154296875,
0.150390625,
0.026611328125,
0.02392578125,
-0.00125885009765625,
-0.053955078125,
-0.03759765625,
-0.0390625,
0.02734375,
-0.01385498046875,
0.00140380859375,
0.0218505859375,
-0.01025390625,
-0.0205078125,
0.04638671875,
0.0145263671875,
-0.00927734375,
0.01025390625,
-0.0225830078125,
-0.00909423828125,
-0.0142822265625,
0.02978515625,
0.0101318359375,
-0.072265625,
-0.049560546875,
0.0311279296875,
0.0101318359375,
-0.00445556640625,
-0.03369140625,
0.0615234375,
-0.021240234375,
-0.034912109375,
-0.004150390625,
0.07177734375,
0.0262451171875,
-0.013671875,
0.03369140625,
0.021728515625,
0.0252685546875,
-0.00982666015625,
-0.0028228759765625,
-0.00151824951171875,
0.003753662109375,
0.004791259765625,
-0.03759765625,
0.025146484375,
0.0235595703125,
-0.0103759765625,
0.0084228515625,
-0.0191650390625,
0.044921875,
0.052001953125,
-0.053955078125,
0.0206298828125,
0.036376953125,
0.01202392578125,
0.0196533203125,
0.025146484375,
-0.000457763671875,
-0.0033721923828125,
-0.0101318359375,
0.005035400390625,
0.0089111328125,
0.002227783203125,
-0.041015625,
0.00927734375,
0.10693359375,
0.01043701171875,
0.00616455078125,
0.013916015625,
0.0035858154296875,
-0.0283203125,
-0.06591796875,
0.016845703125,
-0.0615234375,
-0.01385498046875,
-0.05029296875,
-0.01556396484375,
-0.0128173828125,
-0.0140380859375,
0.00732421875,
-0.0164794921875,
0.01239013671875,
0.0150146484375,
-0.0169677734375,
-0.142578125,
-0.0008087158203125,
-0.007171630859375,
0.0033416748046875,
0.03662109375,
-0.00341796875,
-0.0198974609375,
-0.03955078125,
-0.06640625,
-0.05712890625,
0.0133056640625,
-0.0277099609375,
-0.005462646484375,
-0.0224609375,
0.002166748046875,
0.0296630859375,
-0.030517578125,
-0.029052734375,
0.030517578125,
-0.0162353515625,
-0.0252685546875,
-0.0174560546875,
-0.023193359375,
0.005340576171875,
-0.026611328125,
-0.006011962890625,
-0.01611328125,
-0.033203125,
-0.000820159912109375,
0.04248046875,
-0.0301513671875,
0.019287109375,
0.00909423828125,
0.0400390625,
0.03564453125,
0.030517578125,
0.0140380859375,
-0.0014495849609375,
0.01251220703125,
-0.0556640625,
0.04248046875,
-0.056640625,
-0.030517578125,
-0.009033203125,
-0.01165771484375,
-0.0277099609375,
0.0087890625,
0.024658203125,
-0.043701171875,
0.0146484375,
-0.020751953125,
0.01007080078125,
0.0164794921875,
0.06591796875,
-0.06298828125,
0.0303955078125,
-0.020263671875,
-0.007171630859375,
0.004425048828125,
0.0020751953125,
-0.01373291015625,
0.050537109375,
-0.08203125,
-0.036865234375,
0.019775390625,
-0.0050048828125,
0.06640625,
-0.00823974609375,
0.04248046875,
-0.02734375,
0.004425048828125,
0.006500244140625,
-0.00537109375,
-0.0546875,
0.01470947265625,
0.0089111328125,
0.0025787353515625,
-0.00860595703125,
0.018310546875,
-0.0208740234375,
-0.06689453125,
-0.00592041015625,
-0.0303955078125,
-0.0021514892578125,
0.00372314453125,
0.0218505859375,
-0.0301513671875,
0.02587890625,
-0.01239013671875,
0.04541015625,
0.03662109375,
0.07421875,
0.0225830078125,
0.000385284423828125,
0.06396484375,
-0.0020294189453125,
0.008056640625,
0.0111083984375,
0.0081787109375,
0.033447265625,
-0.01544189453125,
0.09912109375,
-0.00994873046875,
0.0208740234375,
-0.044921875,
-0.017333984375,
0.0211181640625,
0.08056640625,
-0.02294921875,
0.062255859375,
0.01708984375,
-0.011474609375,
0.03125,
0.018798828125,
0.0019683837890625,
0.0390625,
-0.0052490234375,
-0.01312255859375,
-0.002044677734375,
-0.046630859375,
0.015625,
0.037353515625,
0.002777099609375,
-0.00811767578125,
0.0233154296875,
-0.007232666015625,
0.039794921875,
0.009765625,
0.01708984375,
0.043212890625,
0.0101318359375,
0.02783203125,
-0.021484375,
-0.01470947265625,
-0.013671875,
0.01470947265625,
-0.032470703125,
-0.0185546875,
-0.00506591796875,
0.03125,
-0.03125,
0.048095703125,
-0.01165771484375,
0.0296630859375,
0.017822265625,
-0.011474609375,
0.00787353515625,
0.005645751953125,
-0.0093994140625,
0.0380859375,
-0.017333984375,
0.0255126953125,
-0.01806640625,
0.033447265625,
-0.001739501953125,
-0.0191650390625,
0.0054931640625,
0.053466796875,
-0.0308837890625,
-0.006072998046875,
0.0179443359375,
0.025634765625,
-0.01318359375,
0.01214599609375,
-0.0040283203125,
0.03125,
0.047119140625,
0.056640625,
0.01116943359375,
-0.0235595703125,
0.00872802734375,
0.003936767578125,
-0.000652313232421875,
-0.004638671875,
-0.00341796875,
0.0035400390625,
0.0322265625,
0.0169677734375,
0.008056640625,
-0.0262451171875,
-0.080078125,
-0.04638671875,
0.017822265625,
-0.01544189453125,
-0.0296630859375,
0.033203125,
0.10693359375,
0.038330078125,
0.00286865234375,
0.04541015625,
0.021484375,
-0.04931640625,
0.01953125,
-0.035400390625,
-0.07958984375,
-0.07177734375,
-0.004119873046875,
0.0208740234375,
0.10498046875,
-0.006011962890625,
-0.04248046875,
-0.045654296875,
-0.001434326171875,
0.00994873046875,
0.0164794921875,
0.0277099609375,
0.006378173828125,
-0.0286865234375,
0.0191650390625,
-0.02587890625,
0.011474609375,
0.0703125,
0.00732421875,
-0.032470703125,
-0.0211181640625,
-0.05615234375,
0.01092529296875,
0.031494140625,
0.0247802734375,
-0.00372314453125,
-0.0013427734375,
-0.06982421875,
-0.00714111328125,
0.0196533203125,
0.017333984375,
0.01336669921875,
-0.00188446044921875,
-0.01019287109375,
-0.00836181640625,
0.035400390625,
-0.0400390625,
0.01177978515625,
0.009033203125,
0.004425048828125,
0.0157470703125,
0.0015716552734375,
0.007354736328125,
-0.037841796875,
0.01214599609375,
-0.002685546875,
-0.0233154296875,
0.0107421875,
-0.052001953125,
-0.057373046875,
0.007354736328125,
0.007171630859375,
-0.02734375,
-0.005523681640625,
-0.0010528564453125,
-0.0106201171875,
0.0022125244140625,
0.08642578125,
-0.033447265625,
0.03125,
-0.0225830078125,
-0.03125,
0.007049560546875,
-0.0712890625,
-0.0023956298828125,
0.006317138671875,
-0.056640625,
0.0206298828125,
-0.017333984375,
0.048828125,
0.0419921875,
-0.0037078857421875,
0.02978515625,
0.0159912109375,
0.04443359375,
-0.060302734375,
-0.038330078125,
0.0277099609375,
0.036865234375,
0.0322265625,
-0.006011962890625,
-0.022705078125,
-0.050537109375,
0.041748046875,
0.01507568359375,
0.007232666015625,
0.050048828125,
0.041015625,
-0.0240478515625,
0.006561279296875,
0.000301361083984375,
-0.01446533203125,
0.01507568359375,
-0.0556640625,
-0.02734375,
-0.0081787109375,
0.04736328125,
0.0025787353515625,
-0.0283203125,
0.01129150390625,
-0.0252685546875,
0.0225830078125,
0.00421142578125,
-0.004791259765625,
0.005401611328125,
0.006011962890625,
-0.057861328125,
-0.0289306640625,
0.008544921875,
-0.0115966796875,
0.022705078125,
-0.008056640625,
-0.01416015625,
0.0021209716796875,
-0.0038909912109375,
0.01025390625,
-0.0247802734375,
0.01275634765625,
0.031494140625,
-0.00015926361083984375,
-0.004119873046875,
0.041259765625,
-0.040283203125,
0.052734375,
-0.052734375,
-0.0225830078125,
-0.06884765625,
-0.07421875,
-0.0341796875,
0.0196533203125,
0.0038604736328125,
-0.041015625,
-0.005615234375,
-0.039794921875,
-0.0205078125,
0.04931640625,
-0.0289306640625,
0.006561279296875,
0.020751953125,
-0.03369140625,
0.020263671875,
-0.039794921875,
0.0081787109375,
-0.0020294189453125,
0.0218505859375,
0.01611328125,
-0.0281982421875,
-0.027099609375,
0.00131988525390625,
-0.0654296875,
0.023681640625,
-0.006256103515625,
-0.0211181640625,
-0.006103515625,
-0.034912109375,
-0.00299072265625,
-0.0059814453125,
-0.036376953125,
-0.0174560546875,
-0.056640625,
0.000316619873046875,
-0.033935546875,
0.00726318359375,
-0.033447265625,
0.06591796875,
0.0018768310546875,
0.02734375,
-0.04345703125,
0.032958984375,
-0.01953125,
-0.0034332275390625,
0.01300048828125,
0.000713348388671875,
-0.008056640625,
-0.004730224609375,
-0.0341796875,
0.030517578125,
-0.0255126953125,
0.0286865234375,
-0.04638671875,
0.025146484375,
-0.03515625,
0.001220703125,
-0.01068115234375,
0.043212890625,
-0.01416015625,
-0.0223388671875,
-0.03369140625,
-0.0059814453125,
0.007049560546875,
0.0220947265625,
-0.0281982421875,
-0.00811767578125,
-0.00799560546875,
0.0263671875,
0.01373291015625,
0.00194549560546875,
0.20703125,
-0.0076904296875,
0.06591796875,
-0.0059814453125,
0.01043701171875,
-0.01251220703125,
0.038330078125,
-0.0087890625,
0.09765625,
0.003082275390625,
0.0096435546875,
0.000152587890625,
0.02392578125,
-0.04638671875,
-0.007781982421875,
-0.0030975341796875,
-0.00098419189453125,
-0.0181884765625,
-0.007232666015625,
-0.0235595703125,
0.033447265625,
0.0125732421875,
-0.00171661376953125,
0.022216796875,
-0.000278472900390625,
-0.02392578125,
0.0294189453125,
-0.0128173828125,
0.039794921875,
-0.0247802734375,
-0.049560546875,
0.003631591796875,
0.0206298828125,
0.0164794921875,
0.028564453125,
-0.01251220703125,
0.02294921875,
-0.00099945068359375,
-0.022216796875,
-0.050537109375,
0.001861572265625,
-0.0191650390625,
-0.045654296875,
-0.023681640625,
0.004119873046875,
0.050048828125,
-0.007232666015625,
0.05029296875,
-0.027099609375,
-0.0169677734375,
0.035888671875,
-0.02001953125,
-0.0040283203125,
0.01043701171875,
0.0035400390625,
-0.0059814453125,
0.0263671875,
-0.01220703125,
-0.016357421875,
0.01483154296875,
-0.0390625,
-0.00396728515625,
0.04345703125,
0.023193359375,
-0.0172119140625,
0.021240234375,
-0.04736328125,
0.006866455078125,
0.036376953125,
-0.0289306640625,
0.0208740234375,
0.011474609375,
-0.0260009765625,
0.01904296875,
0.016357421875,
-0.04931640625,
-0.0478515625,
0.0213623046875,
-0.01275634765625,
-0.032470703125,
-0.0084228515625,
-0.001922607421875,
0.0191650390625,
0.008544921875,
-0.037353515625,
0.0111083984375,
-0.022705078125,
-0.04052734375,
0.033447265625,
-0.01116943359375,
-0.03369140625,
-0.0167236328125,
-0.0303955078125,
0.0191650390625,
-0.06591796875,
0.00433349609375,
-0.078125,
-0.00732421875,
0.04150390625,
0.00286865234375,
0.0157470703125,
-0.00008440017700195312,
0.041015625,
-0.034423828125,
0.053466796875,
0.005218505859375,
0.01239013671875,
-0.006072998046875,
-0.00628662109375,
0.018798828125,
0.00151824951171875,
0.01165771484375,
0.0164794921875,
0.0089111328125,
0.0247802734375,
0.024658203125,
-0.0031585693359375,
-0.0181884765625,
-0.0103759765625,
-0.04541015625,
0.00323486328125,
0.0157470703125,
-0.004791259765625,
0.0308837890625,
-0.03076171875,
0.00506591796875,
0.02392578125,
-0.0179443359375,
0.0269775390625,
-0.003509521484375,
-0.0181884765625,
0.020263671875,
0.03076171875,
0.00145721435546875,
-0.004547119140625,
0.0167236328125,
0.035400390625,
-0.0206298828125,
-0.0810546875,
-0.0113525390625,
-0.02294921875,
0.0022735595703125,
0.0250244140625,
-0.006561279296875,
0.0223388671875,
0.043212890625,
0.03564453125,
-0.009765625,
0.036376953125,
-0.0028228759765625,
-0.003204345703125,
-0.041748046875,
-0.001495361328125,
-0.05419921875,
-0.04248046875,
-0.01708984375,
-0.002777099609375,
-0.01251220703125,
-0.001739501953125,
-0.0084228515625,
0.00130462646484375,
-0.000579833984375,
-0.0262451171875,
0.01446533203125,
0.037841796875,
0.02001953125,
-0.0157470703125,
-0.017333984375,
0.006317138671875,
0.0125732421875,
-0.0206298828125,
0.02197265625,
0.012939453125,
-0.0162353515625,
-0.068359375,
0.0250244140625,
0.006317138671875,
0.00201416015625,
-0.005126953125,
-0.00872802734375,
-0.06591796875,
0.0233154296875,
-0.01806640625,
-0.01312255859375,
-0.042236328125,
-0.03125,
-0.0198974609375,
-0.00193023681640625,
-0.004364013671875,
-0.0262451171875,
-0.0439453125,
-0.020263671875,
-0.01043701171875,
-0.0250244140625,
0.036865234375,
0.00946044921875,
-0.012939453125,
0.0213623046875,
-0.032470703125,
-0.048095703125,
0.020263671875,
0.00482177734375,
0.048583984375,
0.0301513671875,
-0.046630859375,
-0.021728515625,
-0.00408935546875,
0.0164794921875,
-0.006591796875,
-0.01409912109375,
0.0439453125,
-0.003936767578125,
-0.053955078125,
-0.0123291015625,
-0.025146484375,
-0.0185546875,
-0.061767578125,
0.0045166015625,
-0.01348876953125,
-0.025634765625,
0.0013580322265625,
-0.033447265625,
-0.0093994140625,
-0.039794921875,
0.04638671875,
-0.00799560546875,
-0.03955078125,
-0.015869140625,
0.0322265625,
0.0093994140625,
0.02978515625,
0.005828857421875,
-0.00011873245239257812,
-0.003936767578125,
0.0274658203125,
0.00701904296875,
0.000858306884765625,
-0.0146484375,
0.020263671875,
0.04150390625,
0.0216064453125,
-0.0164794921875,
0.043212890625,
0.0546875,
0.050048828125,
0.01470947265625,
-0.006561279296875,
0.00958251953125,
-0.0164794921875,
-0.01177978515625,
-0.03564453125,
-0.009765625,
0.007598876953125,
-0.00133514404296875,
-0.0322265625,
0.0211181640625,
0.029296875,
0.009765625,
-0.00151824951171875,
-0.0019073486328125,
-0.00830078125,
-0.032958984375,
0.028564453125,
-0.0186767578125,
-0.03369140625,
0.00897216796875,
-0.0040283203125,
-0.01104736328125,
0.01434326171875,
0.05419921875,
0.012939453125,
-0.0341796875,
-0.002471923828125,
-0.01446533203125,
0.04150390625,
0.04541015625,
0.0203857421875,
0.01251220703125,
-0.01348876953125,
0.01312255859375,
0.0052490234375,
0.0419921875,
-0.01092529296875,
-0.022705078125,
-0.0252685546875,
0.00836181640625,
-0.03759765625,
-0.03076171875,
0.009033203125,
-0.017822265625,
-0.00982666015625,
0.04736328125,
0.025634765625,
0.01165771484375,
-0.032470703125,
-0.0267333984375,
0.03515625,
0.0012664794921875,
-0.061767578125,
-0.0089111328125,
0.050048828125,
0.01275634765625,
0.0250244140625,
0.0191650390625,
0.036376953125,
0.005828857421875,
-0.0047607421875,
0.0023956298828125,
-0.031494140625,
-0.003143310546875,
-0.004669189453125,
0.0194091796875,
0.00897216796875,
-0.01104736328125,
0.0849609375,
0.007232666015625,
-0.0201416015625,
-0.0260009765625,
-0.0172119140625,
0.08984375,
0.0517578125,
-0.0260009765625,
-0.0260009765625,
-0.01239013671875,
-0.0247802734375,
0.0164794921875,
-0.0225830078125,
0.018798828125,
-0.038330078125,
-0.0308837890625,
-0.024658203125,
-0.002227783203125,
0.003204345703125,
0.0185546875,
-0.04443359375,
-0.004302978515625,
0.03271484375,
-0.01507568359375,
-0.00080108642578125,
0.038818359375,
0.0040283203125,
0.007049560546875,
-0.0198974609375,
0.004364013671875,
-0.02392578125,
-0.029296875,
-0.0037994384765625,
-0.033447265625,
0.01348876953125,
0.058837890625,
0.00811767578125,
0.0341796875,
0.0064697265625,
0.025146484375,
-0.000492095947265625,
0.0289306640625,
-0.0074462890625,
0.0189208984375,
0.031494140625,
-0.00518798828125,
-0.0283203125,
-0.0011444091796875,
0.03857421875,
0.036376953125,
0.026611328125,
0.005615234375,
-0.0032958984375,
-0.025146484375,
-0.02197265625,
0.0194091796875,
0.0181884765625,
0.07275390625,
-0.0045166015625,
0.025634765625,
-0.0286865234375,
0.0103759765625,
-0.01141357421875,
-0.03564453125,
0.049560546875,
-0.03173828125,
-0.0269775390625,
0.02734375,
0.041015625,
-0.01953125,
-0.0003528594970703125,
-0.0133056640625,
0.0203857421875,
-0.011474609375,
0.0150146484375,
0.0001010894775390625,
-0.01165771484375,
-0.026611328125,
0.03564453125,
-0.012939453125,
0.00024127960205078125,
-0.01446533203125,
0.0322265625,
-0.03125,
-0.0093994140625,
0.00066375732421875,
-0.02197265625,
0.0115966796875,
-0.033935546875,
-0.045166015625,
0.0361328125,
0.017822265625,
0.0322265625,
-0.0263671875,
0.04345703125,
-0.0133056640625,
-0.0478515625,
0.0087890625,
0.0208740234375,
-0.014892578125,
0.0135498046875,
0.044921875,
-0.006011962890625,
-0.0042724609375,
-0.0242919921875,
0.025146484375,
-0.021728515625,
-0.033935546875,
-0.0198974609375,
0.0172119140625,
0.00958251953125,
0.01806640625,
0.04345703125,
-0.01104736328125,
0.036376953125,
0.00141143798828125,
-0.03466796875,
-0.0001964569091796875,
-0.035400390625,
0.0191650390625,
0.0031280517578125,
0.00848388671875,
0.03076171875,
-0.0277099609375,
0.01953125,
0.08447265625,
0.0169677734375,
-0.02783203125,
-0.045166015625,
0.0181884765625,
0.039794921875,
-0.023681640625,
-0.00701904296875,
0.040771484375,
-0.020751953125,
0.06689453125,
-0.048828125,
-0.00164031982421875,
0.006256103515625,
0.01007080078125,
0.00323486328125,
-0.03662109375,
0.0419921875,
0.0002651214599609375,
-0.0301513671875,
-0.0111083984375,
0.072265625,
0.10009765625,
0.03564453125,
-0.0032501220703125,
0.06103515625,
0.0103759765625,
0.011474609375,
-0.034912109375,
-0.0115966796875,
0.025634765625,
-0.062255859375,
-0.01416015625,
0.037841796875,
-0.006683349609375,
-0.04736328125,
0.04345703125,
0.0021514892578125,
-0.0311279296875,
0.00885009765625,
-0.0107421875,
0.00372314453125,
-0.021728515625,
-0.00020503997802734375,
0.000263214111328125,
-0.01446533203125,
0.0028228759765625,
0.0277099609375
]
question_embedding = json.dumps(question_embedding)
question_ocr = "物理"
# res = search_question_text_and_embedding(book_id, question_ocr, question_embedding)
# print(res)
print("\nfinished.") print("\nfinished.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment