lunarflu HF Staff commited on
Commit
ab54bd2
·
1 Parent(s): 69dff14

await semaphore.acquire()

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -78,8 +78,13 @@ async def generation(ctx, attachment, start_time):
78
  if attachment:
79
  style = 'JoJo'
80
 
81
- with semaphore:
 
82
  im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, style)
 
 
 
 
83
  #im = await asyncio.to_thread(jojogan.predict, attachment.url, style)
84
  #im = jojogan.predict(attachment.url, style)
85
 
 
78
  if attachment:
79
  style = 'JoJo'
80
 
81
+ await semaphore.acquire()
82
+ try:
83
  im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, style)
84
+ semaphore.release()
85
+ except Exception as e:
86
+ semaphore.release()
87
+ raise e
88
  #im = await asyncio.to_thread(jojogan.predict, attachment.url, style)
89
  #im = jojogan.predict(attachment.url, style)
90