nharshavardhana commited on
Commit
dfadb93
·
1 Parent(s): 0ea7098
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -239,8 +239,6 @@ def render_grid_image(grid: List[List[str]]) -> str:
239
  import os
240
  from matplotlib.colors import ListedColormap
241
 
242
- # Ensure the static folder exists
243
- os.makedirs("static", exist_ok=True)
244
 
245
  # Mapping from tile type to index
246
  tile_map = {"P": 0, "W": 1, "E": 2, "T": 3, "S": 4, "G": 5}
@@ -257,7 +255,7 @@ def render_grid_image(grid: List[List[str]]) -> str:
257
  numeric_grid = np.array([[tile_map[cell] for cell in row] for row in grid])
258
 
259
  # Save path
260
- image_path = "static/level.png"
261
 
262
  # Render image
263
  fig, ax = plt.subplots(figsize=(6, 6))
@@ -298,7 +296,7 @@ render_image_agent = create_react_agent(
298
  "- Only use the render_grid_image tool to render the grid.\n"
299
  "- When responding, ONLY return the raw file path returned by the tool.\n"
300
  "- Do NOT add any commentary or formatting.\n"
301
- "- Example: static/level.png"
302
  ),
303
  name="render_image_agent"
304
  )
@@ -335,7 +333,7 @@ def run_streamed_supervisor(user_input):
335
  # Look for static image path in last messages
336
  for message in reversed(final_messages):
337
  if hasattr(message, "content") and isinstance(message.content, str):
338
- match = re.search(r"(static/level\.png)", message.content)
339
  if match:
340
  image_path = match.group(1)
341
  break
 
239
  import os
240
  from matplotlib.colors import ListedColormap
241
 
 
 
242
 
243
  # Mapping from tile type to index
244
  tile_map = {"P": 0, "W": 1, "E": 2, "T": 3, "S": 4, "G": 5}
 
255
  numeric_grid = np.array([[tile_map[cell] for cell in row] for row in grid])
256
 
257
  # Save path
258
+ image_path = "/tmp/level.png"
259
 
260
  # Render image
261
  fig, ax = plt.subplots(figsize=(6, 6))
 
296
  "- Only use the render_grid_image tool to render the grid.\n"
297
  "- When responding, ONLY return the raw file path returned by the tool.\n"
298
  "- Do NOT add any commentary or formatting.\n"
299
+ "- Example: /tmp/level.png"
300
  ),
301
  name="render_image_agent"
302
  )
 
333
  # Look for static image path in last messages
334
  for message in reversed(final_messages):
335
  if hasattr(message, "content") and isinstance(message.content, str):
336
+ match = re.search(r"(/tmp/level\.png)", message.content)
337
  if match:
338
  image_path = match.group(1)
339
  break