Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,14 +22,18 @@ def construct_index(directory_path):
|
|
22 |
|
23 |
return index
|
24 |
|
|
|
25 |
def ask_ai():
|
26 |
index = GPTSimpleVectorIndex.load_from_disk('index.json')
|
27 |
while True:
|
28 |
query = input("What do you want to ask? ")
|
29 |
response = index.query(query, response_mode="compact")
|
30 |
display(Markdown(f"Response: <b>{response.response}</b>"))
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
|
34 |
os.environ["OPENAI_API_KEY"] = "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"
|
35 |
|
|
|
22 |
|
23 |
return index
|
24 |
|
25 |
+
'''
|
26 |
def ask_ai():
|
27 |
index = GPTSimpleVectorIndex.load_from_disk('index.json')
|
28 |
while True:
|
29 |
query = input("What do you want to ask? ")
|
30 |
response = index.query(query, response_mode="compact")
|
31 |
display(Markdown(f"Response: <b>{response.response}</b>"))
|
32 |
+
'''
|
33 |
+
def ask_ai(question):
|
34 |
+
index = GPTSimpleVectorIndex.load_from_disk('index.json')
|
35 |
+
response = index.query(question, response_mode="compact")
|
36 |
+
return response.response
|
37 |
|
38 |
os.environ["OPENAI_API_KEY"] = "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"
|
39 |
|