Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ import concurrent.futures
|
|
19 |
import multiprocessing
|
20 |
|
21 |
|
22 |
-
semaphore = Semaphore(4)
|
23 |
|
24 |
DFIF_TOKEN = os.getenv('HF_TOKEN')
|
25 |
DISCORD_TOKEN = os.environ.get("GRADIOTEST_TOKEN", None)
|
@@ -79,7 +79,8 @@ async def discord_before(ctx):
|
|
79 |
async def generation(ctx, attachment, start_time):
|
80 |
if attachment:
|
81 |
style = 'JoJo'
|
82 |
-
|
|
|
83 |
im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, style)
|
84 |
#im = await asyncio.to_thread(jojogan.predict, attachment.url, style)
|
85 |
#im = jojogan.predict(attachment.url, style)
|
|
|
19 |
import multiprocessing
|
20 |
|
21 |
|
22 |
+
semaphore = asyncio.Semaphore(4)
|
23 |
|
24 |
DFIF_TOKEN = os.getenv('HF_TOKEN')
|
25 |
DISCORD_TOKEN = os.environ.get("GRADIOTEST_TOKEN", None)
|
|
|
79 |
async def generation(ctx, attachment, start_time):
|
80 |
if attachment:
|
81 |
style = 'JoJo'
|
82 |
+
|
83 |
+
with semaphore:
|
84 |
im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, style)
|
85 |
#im = await asyncio.to_thread(jojogan.predict, attachment.url, style)
|
86 |
#im = jojogan.predict(attachment.url, style)
|