Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,17 +28,6 @@ options = {
|
|
| 28 |
'RAG': True}
|
| 29 |
}
|
| 30 |
|
| 31 |
-
#option:
|
| 32 |
-
# systemRole, systemStyle, instruction
|
| 33 |
-
|
| 34 |
-
#persist_directory1 = './DB_Decreti'
|
| 35 |
-
#embedding = HuggingFaceEmbeddings(model_name="sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2")
|
| 36 |
-
#db = Chroma(persist_directory=persist_directory1, embedding_function=embedding)
|
| 37 |
-
#NumeroDocumenti = 10
|
| 38 |
-
#query = 'Come funziona la generazione delle PDA'
|
| 39 |
-
#result = db.similarity_search(query, k=NumeroDocumenti)
|
| 40 |
-
|
| 41 |
-
|
| 42 |
st.set_page_config(page_title="BonsiAI", page_icon="🤖")
|
| 43 |
|
| 44 |
def gen_augmented_prompt(prompt, top_k) :
|
|
@@ -109,9 +98,6 @@ def chat_box() :
|
|
| 109 |
st.markdown(message["content"])
|
| 110 |
|
| 111 |
def formattaPrompt(prompt, systemRole, systemStyle, instruction):
|
| 112 |
-
|
| 113 |
-
lunghezza = 'Attenzione! Il testo generato deve essere lungo ' + st.session_state.max_tokens*2 + ' CARATTERI'
|
| 114 |
-
|
| 115 |
if instruction.startswith("http"):
|
| 116 |
try:
|
| 117 |
with st.spinner("Ricerca in Drive...") :
|
|
@@ -170,10 +156,20 @@ def show_source(links) :
|
|
| 170 |
for i, link in enumerate(links) :
|
| 171 |
st.info(f"{link}")
|
| 172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
init_state()
|
| 174 |
sidebar()
|
| 175 |
header()
|
| 176 |
chat_box()
|
|
|
|
| 177 |
|
| 178 |
if prompt := st.chat_input("Chatta con BonsiAI..."):
|
| 179 |
st.chat_message("user").markdown(prompt)
|
|
|
|
| 28 |
'RAG': True}
|
| 29 |
}
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
st.set_page_config(page_title="BonsiAI", page_icon="🤖")
|
| 32 |
|
| 33 |
def gen_augmented_prompt(prompt, top_k) :
|
|
|
|
| 98 |
st.markdown(message["content"])
|
| 99 |
|
| 100 |
def formattaPrompt(prompt, systemRole, systemStyle, instruction):
|
|
|
|
|
|
|
|
|
|
| 101 |
if instruction.startswith("http"):
|
| 102 |
try:
|
| 103 |
with st.spinner("Ricerca in Drive...") :
|
|
|
|
| 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()
|
| 170 |
header()
|
| 171 |
chat_box()
|
| 172 |
+
init_vector_db()
|
| 173 |
|
| 174 |
if prompt := st.chat_input("Chatta con BonsiAI..."):
|
| 175 |
st.chat_message("user").markdown(prompt)
|