Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,6 @@ from llama_index import SimpleDirectoryReader, GPTVectorStoreIndex
|
|
4 |
import os
|
5 |
import shutil
|
6 |
|
7 |
-
os.environ['OPENAI_API_KEY'] = "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"
|
8 |
-
|
9 |
def ingest(docs_dir):
|
10 |
documents = SimpleDirectoryReader(docs_dir).load_data()
|
11 |
index = GPTVectorStoreIndex.from_documents(documents)
|
@@ -20,6 +18,8 @@ def get_answer(index, message):
|
|
20 |
response = query(index, message)
|
21 |
return [('Chatbot', ''.join(response.response))]
|
22 |
|
|
|
|
|
23 |
if os.environ['OPENAI_API_KEY']:
|
24 |
# Initialize chatbot history
|
25 |
chatbot = []
|
@@ -27,7 +27,7 @@ if os.environ['OPENAI_API_KEY']:
|
|
27 |
index = ingest('temp_docs')
|
28 |
|
29 |
# Display message input component
|
30 |
-
message = st.text_input('
|
31 |
|
32 |
# If message is entered, ingest documents and get chatbot response
|
33 |
if message:
|
|
|
4 |
import os
|
5 |
import shutil
|
6 |
|
|
|
|
|
7 |
def ingest(docs_dir):
|
8 |
documents = SimpleDirectoryReader(docs_dir).load_data()
|
9 |
index = GPTVectorStoreIndex.from_documents(documents)
|
|
|
18 |
response = query(index, message)
|
19 |
return [('Chatbot', ''.join(response.response))]
|
20 |
|
21 |
+
os.environ['OPENAI_API_KEY'] = "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"
|
22 |
+
|
23 |
if os.environ['OPENAI_API_KEY']:
|
24 |
# Initialize chatbot history
|
25 |
chatbot = []
|
|
|
27 |
index = ingest('temp_docs')
|
28 |
|
29 |
# Display message input component
|
30 |
+
message = st.text_input('Ingrese su consulta')
|
31 |
|
32 |
# If message is entered, ingest documents and get chatbot response
|
33 |
if message:
|