Spaces:
Runtime error
Runtime error
minor
Browse files
app.py
CHANGED
|
@@ -58,13 +58,13 @@ with st.sidebar:
|
|
| 58 |
chunk_overlap = st.number_input("Chunk overlap", value=def_chunk_overlap, step=10, placeholder=def_chunk_overlap, disabled=disabled)
|
| 59 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=chunk_size, chunk_overlap=chunk_overlap)
|
| 60 |
splits = text_splitter.split_documents(docs)
|
| 61 |
-
vectorstore = Chroma.from_documents(documents=splits, embedding=OpenAIEmbeddings()
|
| 62 |
if chunk_size != def_chunk_size | chunk_overlap != def_chunk_overlap:
|
| 63 |
splits = text_splitter.split_documents(docs)
|
| 64 |
vectorstore = Chroma.from_documents(documents=splits, embedding=OpenAIEmbeddings())
|
| 65 |
print("Created new vectordb for this session.")
|
| 66 |
else:
|
| 67 |
-
vectorstore = Chroma.from_documents(documents=docs, embedding=OpenAIEmbeddings()
|
| 68 |
print("Used vectordb with all blog articles.")
|
| 69 |
|
| 70 |
|
|
@@ -132,16 +132,15 @@ def click_button(prompt):
|
|
| 132 |
|
| 133 |
c = st.container()
|
| 134 |
c.write("Beispielfragen")
|
| 135 |
-
col1, col2, col3 = c.columns(3)
|
| 136 |
if data_source == 'Blog articles':
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
elif data_source == 'FAQ':
|
| 143 |
examples = ['Wie komme ich an meinen PDF-Report?', 'Wer steckt hinter den Kurs-Inhalten?', 'Wozu dient der Check-Out?']
|
| 144 |
-
for i, col in enumerate(c.columns(
|
| 145 |
question = examples[i]
|
| 146 |
col.button(question, on_click=click_button, args=[question])
|
| 147 |
|
|
|
|
| 58 |
chunk_overlap = st.number_input("Chunk overlap", value=def_chunk_overlap, step=10, placeholder=def_chunk_overlap, disabled=disabled)
|
| 59 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=chunk_size, chunk_overlap=chunk_overlap)
|
| 60 |
splits = text_splitter.split_documents(docs)
|
| 61 |
+
vectorstore = Chroma.from_documents(documents=splits, embedding=OpenAIEmbeddings())
|
| 62 |
if chunk_size != def_chunk_size | chunk_overlap != def_chunk_overlap:
|
| 63 |
splits = text_splitter.split_documents(docs)
|
| 64 |
vectorstore = Chroma.from_documents(documents=splits, embedding=OpenAIEmbeddings())
|
| 65 |
print("Created new vectordb for this session.")
|
| 66 |
else:
|
| 67 |
+
vectorstore = Chroma.from_documents(documents=docs, embedding=OpenAIEmbeddings())
|
| 68 |
print("Used vectordb with all blog articles.")
|
| 69 |
|
| 70 |
|
|
|
|
| 132 |
|
| 133 |
c = st.container()
|
| 134 |
c.write("Beispielfragen")
|
|
|
|
| 135 |
if data_source == 'Blog articles':
|
| 136 |
+
examples = ['Was ist Pacing?', 'Wie funktioniert die Wiedereingliederung?', 'Sollte ich eine Reha machen?']
|
| 137 |
+
for i, col in enumerate(c.columns(len(examples))):
|
| 138 |
+
question = examples[i]
|
| 139 |
+
col.button(question, on_click=click_button, args=[question])
|
| 140 |
+
|
| 141 |
elif data_source == 'FAQ':
|
| 142 |
examples = ['Wie komme ich an meinen PDF-Report?', 'Wer steckt hinter den Kurs-Inhalten?', 'Wozu dient der Check-Out?']
|
| 143 |
+
for i, col in enumerate(c.columns(len(examples))):
|
| 144 |
question = examples[i]
|
| 145 |
col.button(question, on_click=click_button, args=[question])
|
| 146 |
|