mirror of
https://github.com/osmarks/meme-search-engine.git
synced 2025-12-23 16:26:05 +00:00
Predefined embedding modes in search
This commit is contained in:
14
load_embedding.py
Normal file
14
load_embedding.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import numpy as np
|
||||
import sqlite3
|
||||
import base64
|
||||
|
||||
#db = sqlite3.connect("/srv/mse/data.sqlite3")
|
||||
db = sqlite3.connect("data.sqlite3")
|
||||
db.row_factory = sqlite3.Row
|
||||
|
||||
name = input("Name: ")
|
||||
url = input("Embedding search URL: ")
|
||||
data = base64.urlsafe_b64decode(url.removeprefix("https://mse.osmarks.net/?e="))
|
||||
arr = np.frombuffer(data, dtype=np.float16).copy()
|
||||
db.execute("INSERT OR REPLACE INTO predefined_embeddings VALUES (?, ?)", (name, arr.tobytes()))
|
||||
db.commit()
|
||||
Reference in New Issue
Block a user