Spaces:
Sleeping
Sleeping
zhangfeng144
commited on
Commit
·
e920edc
1
Parent(s):
57ebb8d
update
Browse files- .sticker.db.lock +0 -0
- Dockerfile +0 -1
- app/config.py +0 -1
- embedding_test.py +4 -2
.sticker.db.lock
DELETED
|
File without changes
|
Dockerfile
CHANGED
|
@@ -9,7 +9,6 @@ COPY ./sticker.db /tmp/sticker.db
|
|
| 9 |
|
| 10 |
ENV HF_HOME=/tmp/.cache
|
| 11 |
|
| 12 |
-
|
| 13 |
CMD python main.py
|
| 14 |
|
| 15 |
EXPOSE 7860
|
|
|
|
| 9 |
|
| 10 |
ENV HF_HOME=/tmp/.cache
|
| 11 |
|
|
|
|
| 12 |
CMD python main.py
|
| 13 |
|
| 14 |
EXPOSE 7860
|
app/config.py
CHANGED
|
@@ -5,7 +5,6 @@ DATASET_ID = "Nekoko/StickerSet"
|
|
| 5 |
COZE_API_TOKEN = os.getenv('COZE_API_TOKEN')
|
| 6 |
HUGGING_FACE_TOKEN = os.getenv('HUGGING_FACE_TOKEN')
|
| 7 |
DEEPSEEK_API_KEY = os.getenv('DEEPSEEK_API_KEY')
|
| 8 |
-
MILVUS_DB_FILE = os.getenv('MILVUS_DB_FILE', "./sticker.db")
|
| 9 |
MILVUS_DB_URL = os.getenv('MILVUS_DB_URL', "./sticker.db")
|
| 10 |
MILVUS_DB_TOKEN = os.getenv('MILVUS_DB_TOKEN', "")
|
| 11 |
EMBEDDING_MODEL = 'shibing624/text2vec-base-chinese'
|
|
|
|
| 5 |
COZE_API_TOKEN = os.getenv('COZE_API_TOKEN')
|
| 6 |
HUGGING_FACE_TOKEN = os.getenv('HUGGING_FACE_TOKEN')
|
| 7 |
DEEPSEEK_API_KEY = os.getenv('DEEPSEEK_API_KEY')
|
|
|
|
| 8 |
MILVUS_DB_URL = os.getenv('MILVUS_DB_URL', "./sticker.db")
|
| 9 |
MILVUS_DB_TOKEN = os.getenv('MILVUS_DB_TOKEN', "")
|
| 10 |
EMBEDDING_MODEL = 'shibing624/text2vec-base-chinese'
|
embedding_test.py
CHANGED
|
@@ -7,6 +7,8 @@ from pymilvus import MilvusClient, DataType
|
|
| 7 |
import time
|
| 8 |
import gradio as gr
|
| 9 |
|
|
|
|
|
|
|
| 10 |
# 配置日志
|
| 11 |
logging.basicConfig(
|
| 12 |
level=logging.INFO,
|
|
@@ -66,7 +68,7 @@ class SentenceTransformerModel(BaseEmbeddingModel):
|
|
| 66 |
class StickerSearcher:
|
| 67 |
def __init__(self, model: BaseEmbeddingModel):
|
| 68 |
self.model = model
|
| 69 |
-
self.client = MilvusClient(uri=
|
| 70 |
self.collection_name = f'test_{model.model_name.replace("/", "_").replace("-", "_")}'
|
| 71 |
|
| 72 |
def init_collection(self) -> bool:
|
|
@@ -158,7 +160,7 @@ def create_gradio_ui():
|
|
| 158 |
|
| 159 |
def init_collections():
|
| 160 |
try:
|
| 161 |
-
client = MilvusClient(uri=
|
| 162 |
stickers = client.query(
|
| 163 |
collection_name='stickers',
|
| 164 |
filter='',
|
|
|
|
| 7 |
import time
|
| 8 |
import gradio as gr
|
| 9 |
|
| 10 |
+
from app.config import MILVUS_DB_URL
|
| 11 |
+
|
| 12 |
# 配置日志
|
| 13 |
logging.basicConfig(
|
| 14 |
level=logging.INFO,
|
|
|
|
| 68 |
class StickerSearcher:
|
| 69 |
def __init__(self, model: BaseEmbeddingModel):
|
| 70 |
self.model = model
|
| 71 |
+
self.client = MilvusClient(uri=MILVUS_DB_URL)
|
| 72 |
self.collection_name = f'test_{model.model_name.replace("/", "_").replace("-", "_")}'
|
| 73 |
|
| 74 |
def init_collection(self) -> bool:
|
|
|
|
| 160 |
|
| 161 |
def init_collections():
|
| 162 |
try:
|
| 163 |
+
client = MilvusClient(uri=MILVUS_DB_URL)
|
| 164 |
stickers = client.query(
|
| 165 |
collection_name='stickers',
|
| 166 |
filter='',
|