Spaces:
Sleeping
Sleeping
vijay
commited on
Commit
·
59126b2
1
Parent(s):
bf0f320
adding api key from dotenv
Browse files- app.py +6 -0
- requirements.txt +2 -0
app.py
CHANGED
|
@@ -14,6 +14,12 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 14 |
class BasicAgent:
|
| 15 |
def __init__(self):
|
| 16 |
print("BasicAgent initialized.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
self.agent = CodeAgent(tools=[DuckDuckGoSearchTool(), PythonInterpreterTool()],
|
| 18 |
model=OpenAIServerModel(model_id = "gpt-4o"))
|
| 19 |
|
|
|
|
| 14 |
class BasicAgent:
|
| 15 |
def __init__(self):
|
| 16 |
print("BasicAgent initialized.")
|
| 17 |
+
try:
|
| 18 |
+
import dotenv
|
| 19 |
+
dotenv.load_dotenv()
|
| 20 |
+
print("Loaded environment variables from .env file")
|
| 21 |
+
except ImportError:
|
| 22 |
+
print("python-dotenv not installed, continuing with environment as is")
|
| 23 |
self.agent = CodeAgent(tools=[DuckDuckGoSearchTool(), PythonInterpreterTool()],
|
| 24 |
model=OpenAIServerModel(model_id = "gpt-4o"))
|
| 25 |
|
requirements.txt
CHANGED
|
@@ -2,3 +2,5 @@ gradio
|
|
| 2 |
requests
|
| 3 |
smolagents[openai]
|
| 4 |
smolagents==1.13.0
|
|
|
|
|
|
|
|
|
| 2 |
requests
|
| 3 |
smolagents[openai]
|
| 4 |
smolagents==1.13.0
|
| 5 |
+
openai
|
| 6 |
+
python-dotenv
|