Spaces:
Runtime error
Runtime error
vector clear
Browse files
app.py
CHANGED
@@ -4,10 +4,11 @@ from lancedb.embeddings import get_registry
|
|
4 |
from lancedb.pydantic import LanceModel, Vector
|
5 |
import gradio as gr
|
6 |
from downloader import dowload_and_save_audio, dowload_and_save_image, base_path
|
|
|
|
|
7 |
|
8 |
model = get_registry().get("imagebind").create()
|
9 |
|
10 |
-
|
11 |
class TextModel(LanceModel):
|
12 |
text: str
|
13 |
image_uri: str = model.SourceField()
|
@@ -25,7 +26,10 @@ inputs = [
|
|
25 |
for a, b, c in zip(text_list, audio_paths, image_paths)
|
26 |
]
|
27 |
|
28 |
-
|
|
|
|
|
|
|
29 |
table = db.create_table("img_bind", schema=TextModel)
|
30 |
table.add(inputs)
|
31 |
|
|
|
4 |
from lancedb.pydantic import LanceModel, Vector
|
5 |
import gradio as gr
|
6 |
from downloader import dowload_and_save_audio, dowload_and_save_image, base_path
|
7 |
+
import os
|
8 |
+
import shutil
|
9 |
|
10 |
model = get_registry().get("imagebind").create()
|
11 |
|
|
|
12 |
class TextModel(LanceModel):
|
13 |
text: str
|
14 |
image_uri: str = model.SourceField()
|
|
|
26 |
for a, b, c in zip(text_list, audio_paths, image_paths)
|
27 |
]
|
28 |
|
29 |
+
dirpath = "/tmp/lancedb"
|
30 |
+
if os.path.exists(dirpath) and os.path.isdir(dirpath):
|
31 |
+
shutil.rmtree(dirpath)
|
32 |
+
db = lancedb.connect(dirpath)
|
33 |
table = db.create_table("img_bind", schema=TextModel)
|
34 |
table.add(inputs)
|
35 |
|