kfahn commited on
Commit
7348fc4
·
verified ·
1 Parent(s): 8c95909

Update app.py

Browse files

add

@tool
decorator which got accidentally deleted

Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -71,11 +71,13 @@ async def capture_screenshot(image_type: str):
71
  await browser.close()
72
  print("Screenshot saved!")
73
 
74
-
75
- def grab_image() -> Image:
76
  """
77
  Fetches an op art image from a p5.js sketch.
78
  This function sends uses Playwright to launch a headless server and grab a screenshot of a p5.js sketch.
 
 
79
  Returns:
80
  image: The screen shot of the p5.js sketch as an image.
81
  """
@@ -83,7 +85,7 @@ def grab_image() -> Image:
83
 
84
  loop = asyncio.new_event_loop() # Create a new event loop (Fixes issues on HF Spaces)
85
  asyncio.set_event_loop(loop)
86
- loop.run_until_complete(capture_screenshot())
87
 
88
  print("Loading image for Gradio...")
89
  img = Image.open("img.png")
 
71
  await browser.close()
72
  print("Screenshot saved!")
73
 
74
+ @tool
75
+ def grab_image(image_type: str) -> Image:
76
  """
77
  Fetches an op art image from a p5.js sketch.
78
  This function sends uses Playwright to launch a headless server and grab a screenshot of a p5.js sketch.
79
+ Args:
80
+ image_type: A geneerate art type
81
  Returns:
82
  image: The screen shot of the p5.js sketch as an image.
83
  """
 
85
 
86
  loop = asyncio.new_event_loop() # Create a new event loop (Fixes issues on HF Spaces)
87
  asyncio.set_event_loop(loop)
88
+ loop.run_until_complete(capture_screenshot(image_type))
89
 
90
  print("Loading image for Gradio...")
91
  img = Image.open("img.png")