eaglelandsonce commited on
Commit
be3e20e
·
verified ·
1 Parent(s): eded704

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -8,18 +8,17 @@ def run_hello_world(api_key):
8
  if not api_key:
9
  return "Please enter your OpenAI API key."
10
 
11
- # Set environment variable dynamically
12
  os.environ["OPENAI_API_KEY"] = api_key
13
 
14
  try:
15
- # Create model + agent
16
- model = OpenAIModel(model="gpt-4o-mini")
 
17
  agent = CodeAgent(
18
  model=model,
19
  tools=[]
20
  )
21
 
22
- # Run hello world task
23
  result = agent.run("Say hello world in a fun way!")
24
  return result
25
 
@@ -27,7 +26,6 @@ def run_hello_world(api_key):
27
  return f"Error: {str(e)}"
28
 
29
 
30
- # Gradio UI
31
  with gr.Blocks() as demo:
32
  gr.Markdown("# 🤖 SmolAgents Hello World Demo")
33
  gr.Markdown("Paste your OpenAI API key and press the button.")
 
8
  if not api_key:
9
  return "Please enter your OpenAI API key."
10
 
 
11
  os.environ["OPENAI_API_KEY"] = api_key
12
 
13
  try:
14
+ # FIX: use model_id instead of model
15
+ model = OpenAIModel(model_id="gpt-4o-mini")
16
+
17
  agent = CodeAgent(
18
  model=model,
19
  tools=[]
20
  )
21
 
 
22
  result = agent.run("Say hello world in a fun way!")
23
  return result
24
 
 
26
  return f"Error: {str(e)}"
27
 
28
 
 
29
  with gr.Blocks() as demo:
30
  gr.Markdown("# 🤖 SmolAgents Hello World Demo")
31
  gr.Markdown("Paste your OpenAI API key and press the button.")