Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,10 @@ import os
|
|
| 5 |
import gradio as gr
|
| 6 |
from gradio import ChatMessage
|
| 7 |
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
#load_dotenv()
|
| 10 |
|
|
@@ -17,9 +21,9 @@ import time
|
|
| 17 |
api_key = os.getenv('GEMINI_API_KEY')
|
| 18 |
|
| 19 |
if api_key:
|
| 20 |
-
|
| 21 |
else:
|
| 22 |
-
|
| 23 |
|
| 24 |
|
| 25 |
client = OpenAI(api_key=api_key,
|
|
@@ -80,9 +84,9 @@ def llm_response(message, history):
|
|
| 80 |
messages= history)
|
| 81 |
|
| 82 |
parsed_response = json.loads(llm_response.choices[0].message.content)
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
time.sleep(2)
|
| 87 |
history.append({"role": "assistant", "content": parsed_response['content']})
|
| 88 |
if parsed_response['step'] == 'result':
|
|
|
|
| 5 |
import gradio as gr
|
| 6 |
from gradio import ChatMessage
|
| 7 |
import time
|
| 8 |
+
import logging
|
| 9 |
+
|
| 10 |
+
# Configure logging
|
| 11 |
+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
| 12 |
|
| 13 |
#load_dotenv()
|
| 14 |
|
|
|
|
| 21 |
api_key = os.getenv('GEMINI_API_KEY')
|
| 22 |
|
| 23 |
if api_key:
|
| 24 |
+
logging.info("API Key Loaded Successfully!")
|
| 25 |
else:
|
| 26 |
+
logging.info("API Key Missing!")
|
| 27 |
|
| 28 |
|
| 29 |
client = OpenAI(api_key=api_key,
|
|
|
|
| 84 |
messages= history)
|
| 85 |
|
| 86 |
parsed_response = json.loads(llm_response.choices[0].message.content)
|
| 87 |
+
logging.info("________________________________")
|
| 88 |
+
logging.info(parsed_response)
|
| 89 |
+
logging.info("________________________________")
|
| 90 |
time.sleep(2)
|
| 91 |
history.append({"role": "assistant", "content": parsed_response['content']})
|
| 92 |
if parsed_response['step'] == 'result':
|