Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,13 +18,13 @@ def get_embeddings_from_texts(openai_apikey,text):
|
|
18 |
return reponse['data'][0]['embedding']
|
19 |
|
20 |
def doc_index(txt, openai_apikey):
|
21 |
-
|
22 |
path = str(time.time())
|
23 |
import os
|
24 |
os.mkdir(path)
|
25 |
with open(path + '/doc.txt', mode = 'w', encoding = 'utf-8') as f:
|
26 |
f.write(txt)
|
27 |
-
|
28 |
documents = SimpleDirectoryReader(path).load_data()
|
29 |
index = GPTVectorStoreIndex.from_documents(documents)
|
30 |
template = (
|
@@ -89,5 +89,5 @@ with gr.Blocks() as demo:
|
|
89 |
|
90 |
if __name__ == "__main__":
|
91 |
demo.queue().launch()
|
92 |
-
|
93 |
|
|
|
18 |
return reponse['data'][0]['embedding']
|
19 |
|
20 |
def doc_index(txt, openai_apikey):
|
21 |
+
openai.api_key = openai_apikey
|
22 |
path = str(time.time())
|
23 |
import os
|
24 |
os.mkdir(path)
|
25 |
with open(path + '/doc.txt', mode = 'w', encoding = 'utf-8') as f:
|
26 |
f.write(txt)
|
27 |
+
|
28 |
documents = SimpleDirectoryReader(path).load_data()
|
29 |
index = GPTVectorStoreIndex.from_documents(documents)
|
30 |
template = (
|
|
|
89 |
|
90 |
if __name__ == "__main__":
|
91 |
demo.queue().launch()
|
92 |
+
|
93 |
|