Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,9 +7,6 @@ import sys
|
|
7 |
|
8 |
from IPython.display import Markdown, display
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
def construct_index(directory_path):
|
14 |
|
15 |
max_input_size = 4096
|
@@ -26,12 +23,13 @@ def construct_index(directory_path):
|
|
26 |
|
27 |
|
28 |
def ask_ai(question,api):
|
|
|
29 |
os.environ["OPENAI_API_KEY"] = api
|
30 |
index = GPTSimpleVectorIndex.load_from_disk('index.json')
|
31 |
response = index.query(question, response_mode="compact")
|
32 |
return response.response
|
33 |
|
34 |
-
|
35 |
|
36 |
construct_index("data")
|
37 |
api_key = gr.inputs.Textbox(label="OpenAI API Key")
|
|
|
7 |
|
8 |
from IPython.display import Markdown, display
|
9 |
|
|
|
|
|
|
|
10 |
def construct_index(directory_path):
|
11 |
|
12 |
max_input_size = 4096
|
|
|
23 |
|
24 |
|
25 |
def ask_ai(question,api):
|
26 |
+
if api != ""
|
27 |
os.environ["OPENAI_API_KEY"] = api
|
28 |
index = GPTSimpleVectorIndex.load_from_disk('index.json')
|
29 |
response = index.query(question, response_mode="compact")
|
30 |
return response.response
|
31 |
|
32 |
+
os.environ["OPENAI_API_KEY"] = "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"
|
33 |
|
34 |
construct_index("data")
|
35 |
api_key = gr.inputs.Textbox(label="OpenAI API Key")
|