lunarflu HF Staff commited on
Commit
4c610fc
·
1 Parent(s): e8b1c8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -19,7 +19,7 @@ import concurrent.futures
19
  import multiprocessing
20
 
21
 
22
- semaphore = asyncio.Semaphore(2)
23
 
24
  DFIF_TOKEN = os.getenv('HF_TOKEN')
25
  DISCORD_TOKEN = os.environ.get("GRADIOTEST_TOKEN", None)
@@ -78,14 +78,11 @@ async def generation(ctx, attachment, start_time):
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
- print('semaphore error')
87
- semaphore.release()
88
- raise e
89
  #im = await asyncio.to_thread(jojogan.predict, attachment.url, style)
90
  #im = jojogan.predict(attachment.url, style)
91
 
 
19
  import multiprocessing
20
 
21
 
22
+ #semaphore = asyncio.Semaphore(2)
23
 
24
  DFIF_TOKEN = os.getenv('HF_TOKEN')
25
  DISCORD_TOKEN = os.environ.get("GRADIOTEST_TOKEN", None)
 
78
  if attachment:
79
  style = 'JoJo'
80
 
81
+ loop = asyncio.get_running_loop()
82
+ im = loop.run_in_executor(None, jojogan.predict, attachment.url, style)
83
+ #im = await asyncio.get_running_loop().run_in_executor(None, jojogan.predict, attachment.url, style)
84
+ #semaphore.release()
85
+
 
 
 
86
  #im = await asyncio.to_thread(jojogan.predict, attachment.url, style)
87
  #im = jojogan.predict(attachment.url, style)
88