Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,27 @@
|
|
2 |
from langchain_community.vectorstores import Qdrant
|
3 |
from langchain_community.embeddings import SentenceTransformerEmbeddings
|
4 |
from qdrant_client import QdrantClient
|
|
|
|
|
5 |
import pandas as pd
|
6 |
import gradio as gd
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
embeddings = SentenceTransformerEmbeddings(model_name='sentence-transformers/clip-ViT-B-32')
|
9 |
|
10 |
def get_results(search_results):
|
|
|
2 |
from langchain_community.vectorstores import Qdrant
|
3 |
from langchain_community.embeddings import SentenceTransformerEmbeddings
|
4 |
from qdrant_client import QdrantClient
|
5 |
+
from transformers import AutoModel, AutoTokenizer
|
6 |
+
import os
|
7 |
import pandas as pd
|
8 |
import gradio as gd
|
9 |
|
10 |
+
# Get the current directory
|
11 |
+
current_directory = os.getcwd()
|
12 |
+
|
13 |
+
# Define the model name
|
14 |
+
model_name = 'sentence-transformers/clip-ViT-B-32'
|
15 |
+
|
16 |
+
# Load the model and tokenizer
|
17 |
+
model = AutoModel.from_pretrained(model_name)
|
18 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
19 |
+
|
20 |
+
# Save the model and tokenizer to the current directory
|
21 |
+
model.save_pretrained(current_directory)
|
22 |
+
tokenizer.save_pretrained(current_directory)
|
23 |
+
|
24 |
+
print(f"Model and tokenizer saved in the current directory: {current_directory}")
|
25 |
+
|
26 |
embeddings = SentenceTransformerEmbeddings(model_name='sentence-transformers/clip-ViT-B-32')
|
27 |
|
28 |
def get_results(search_results):
|