Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,8 @@ def construct_index(directory_path):
|
|
21 |
llm_predictor = LLMPredictor(llm=OpenAI(temperature=0.5, model_name="gpt-3.5-turbo", max_tokens=num_outputs))
|
22 |
prompt_helper = PromptHelper(max_input_size, num_outputs, max_chunk_overlap, chunk_size_limit=chunk_size_limit)
|
23 |
|
24 |
-
|
|
|
25 |
def ask_ai(question,api):
|
26 |
if api == "":
|
27 |
os.environ["OPENAI_API_KEY"] = "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"
|
@@ -29,9 +30,8 @@ def ask_ai(question,api):
|
|
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")
|
36 |
iface = gr.Interface(fn=ask_ai, inputs=["text", api_key], outputs="text", title="Chatbot")
|
37 |
|
|
|
21 |
llm_predictor = LLMPredictor(llm=OpenAI(temperature=0.5, model_name="gpt-3.5-turbo", max_tokens=num_outputs))
|
22 |
prompt_helper = PromptHelper(max_input_size, num_outputs, max_chunk_overlap, chunk_size_limit=chunk_size_limit)
|
23 |
|
24 |
+
construct_index("data")
|
25 |
+
|
26 |
def ask_ai(question,api):
|
27 |
if api == "":
|
28 |
os.environ["OPENAI_API_KEY"] = "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"
|
|
|
30 |
response = index.query(question, response_mode="compact")
|
31 |
return response.response
|
32 |
|
33 |
+
#os.environ["OPENAI_API_KEY"] = "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"
|
34 |
|
|
|
35 |
api_key = gr.inputs.Textbox(label="OpenAI API Key")
|
36 |
iface = gr.Interface(fn=ask_ai, inputs=["text", api_key], outputs="text", title="Chatbot")
|
37 |
|