await semaphore.acquire()
Browse files
app.py
CHANGED
|
@@ -78,8 +78,13 @@ async def generation(ctx, attachment, start_time):
|
|
| 78 |
if attachment:
|
| 79 |
style = 'JoJo'
|
| 80 |
|
| 81 |
-
|
|
|
|
| 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 |
|