Spaces:
Sleeping
Sleeping
Commit
•
146cded
1
Parent(s):
e6a3240
Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,9 @@ import os
|
|
5 |
from dotenv import load_dotenv
|
6 |
from sentence_transformers import SentenceTransformer
|
7 |
import requests
|
8 |
-
|
9 |
-
|
|
|
10 |
load_dotenv()
|
11 |
URL_CARTELLA = os.getenv('URL_CARTELLA')
|
12 |
|
@@ -156,14 +157,13 @@ def show_source(links) :
|
|
156 |
for i, link in enumerate(links) :
|
157 |
st.info(f"{link}")
|
158 |
|
159 |
-
def init_vector_db()
|
160 |
persist_directory1 = './DB_Decreti'
|
161 |
embedding = HuggingFaceEmbeddings(model_name="sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2")
|
162 |
db = Chroma(persist_directory=persist_directory1, embedding_function=embedding)
|
163 |
#NumeroDocumenti = 10
|
164 |
#query = 'Come funziona la generazione delle PDA'
|
165 |
#result = db.similarity_search(query, k=NumeroDocumenti)
|
166 |
-
}
|
167 |
|
168 |
init_state()
|
169 |
sidebar()
|
|
|
5 |
from dotenv import load_dotenv
|
6 |
from sentence_transformers import SentenceTransformer
|
7 |
import requests
|
8 |
+
from langchain_community.vectorstores import Chroma
|
9 |
+
from langchain_community.embeddings import HuggingFaceEmbeddings
|
10 |
+
|
11 |
load_dotenv()
|
12 |
URL_CARTELLA = os.getenv('URL_CARTELLA')
|
13 |
|
|
|
157 |
for i, link in enumerate(links) :
|
158 |
st.info(f"{link}")
|
159 |
|
160 |
+
def init_vector_db():
|
161 |
persist_directory1 = './DB_Decreti'
|
162 |
embedding = HuggingFaceEmbeddings(model_name="sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2")
|
163 |
db = Chroma(persist_directory=persist_directory1, embedding_function=embedding)
|
164 |
#NumeroDocumenti = 10
|
165 |
#query = 'Come funziona la generazione delle PDA'
|
166 |
#result = db.similarity_search(query, k=NumeroDocumenti)
|
|
|
167 |
|
168 |
init_state()
|
169 |
sidebar()
|