Spaces:
Runtime error
Runtime error
verify_api_key
Browse files- __pycache__/ai_functions.cpython-311.pyc +0 -0
- app.py +5 -5
__pycache__/ai_functions.cpython-311.pyc
ADDED
Binary file (3.47 kB). View file
|
|
app.py
CHANGED
@@ -19,12 +19,12 @@ def analyze_user_data(likes, dislikes, allergens, diet_plan, calorie_intake, mea
|
|
19 |
return ai_functions.ai_function("AnylizeJson", description)
|
20 |
|
21 |
def verify_api_key(api_key):
|
|
|
|
|
|
|
|
|
22 |
try:
|
23 |
-
|
24 |
-
ai_functions.client = OpenAI(api_key=os.environ.get("API_KEY"))
|
25 |
-
else:
|
26 |
-
ai_functions.client = OpenAI(api_key=api_key)
|
27 |
-
|
28 |
return f"OpenAI API is verified."
|
29 |
except Exception as e:
|
30 |
return f"OpenAI API isn't verified."
|
|
|
19 |
return ai_functions.ai_function("AnylizeJson", description)
|
20 |
|
21 |
def verify_api_key(api_key):
|
22 |
+
if os.environ.get("PASSWORD") == api_key:
|
23 |
+
ai_functions.client = OpenAI(api_key=os.environ.get("API_KEY"))
|
24 |
+
else:
|
25 |
+
ai_functions.client = OpenAI(api_key=api_key)
|
26 |
try:
|
27 |
+
ai_functions.client.models.list()
|
|
|
|
|
|
|
|
|
28 |
return f"OpenAI API is verified."
|
29 |
except Exception as e:
|
30 |
return f"OpenAI API isn't verified."
|