Spaces:
Build error
Build error
Debug OpenAI API key issue
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ initial_prompt = "List the following in a HTML table with about 10 rows in an ap
|
|
| 9 |
title_prompt = "Write a title without quotation marks for a table that contains the following information: "
|
| 10 |
prompt = ""
|
| 11 |
|
|
|
|
| 12 |
def set_openai_api_key(api_key, openai_api_key):
|
| 13 |
if api_key:
|
| 14 |
openai_api_key = api_key
|
|
@@ -19,7 +20,7 @@ def openai_create(prompt, openai_api_key):
|
|
| 19 |
print("\n==== date/time: " + str(datetime.datetime.now()) + " ====")
|
| 20 |
print("prompt: " + prompt)
|
| 21 |
print("gpt_temperature: ", gpt_temperature)
|
| 22 |
-
print("openai_api_key: ", openai_api_key)
|
| 23 |
|
| 24 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 25 |
response = openai.Completion.create(
|
|
@@ -43,6 +44,7 @@ def desc2sheet(desc, openai_api_key):
|
|
| 43 |
print("\n==== date/time: " + str(datetime.datetime.now()) + " ====")
|
| 44 |
print("desc: " + desc)
|
| 45 |
print("gpt_temperature: ", gpt_temperature)
|
|
|
|
| 46 |
|
| 47 |
html = openai_create(initial_prompt + desc + '\n', openai_api_key)
|
| 48 |
return html
|
|
|
|
| 9 |
title_prompt = "Write a title without quotation marks for a table that contains the following information: "
|
| 10 |
prompt = ""
|
| 11 |
|
| 12 |
+
|
| 13 |
def set_openai_api_key(api_key, openai_api_key):
|
| 14 |
if api_key:
|
| 15 |
openai_api_key = api_key
|
|
|
|
| 20 |
print("\n==== date/time: " + str(datetime.datetime.now()) + " ====")
|
| 21 |
print("prompt: " + prompt)
|
| 22 |
print("gpt_temperature: ", gpt_temperature)
|
| 23 |
+
print("in openai_create openai_api_key: ", openai_api_key)
|
| 24 |
|
| 25 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 26 |
response = openai.Completion.create(
|
|
|
|
| 44 |
print("\n==== date/time: " + str(datetime.datetime.now()) + " ====")
|
| 45 |
print("desc: " + desc)
|
| 46 |
print("gpt_temperature: ", gpt_temperature)
|
| 47 |
+
print("in desc2sheet openai_api_key: ", openai_api_key)
|
| 48 |
|
| 49 |
html = openai_create(initial_prompt + desc + '\n', openai_api_key)
|
| 50 |
return html
|