Spaces:
Build error
Build error
Commit
·
49088d7
1
Parent(s):
e3c12f6
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,13 +7,14 @@ import sys
|
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
host = "wss://spaces.huggingface.tech/farukozderim/test-new-queue/queue/join"
|
| 10 |
-
duration_list = []
|
|
|
|
| 11 |
|
| 12 |
async def startup(client_count, interval_duration):
|
| 13 |
begin = time.time()
|
| 14 |
await asyncio.gather(*[client(i, interval_duration) for i in range(client_count)])
|
| 15 |
end = time.time()
|
| 16 |
-
return f"Total-duration: {round(end-begin,3)}, success: {
|
| 17 |
|
| 18 |
async def client(rank, interval_duration):
|
| 19 |
await asyncio.sleep(rank*interval_duration) # Server cannot handle a lot of instantanous conns
|
|
@@ -34,7 +35,7 @@ async def client(rank, interval_duration):
|
|
| 34 |
end = time.time()
|
| 35 |
duration = end - start
|
| 36 |
if jso["success"]:
|
| 37 |
-
|
| 38 |
return
|
| 39 |
|
| 40 |
describe = f'Sends x number of events(requests) with y second intervals to the another space, https://huggingface.co/spaces/farukozderim/test-new-queue'
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
host = "wss://spaces.huggingface.tech/farukozderim/test-new-queue/queue/join"
|
| 10 |
+
#duration_list = []
|
| 11 |
+
success = 0
|
| 12 |
|
| 13 |
async def startup(client_count, interval_duration):
|
| 14 |
begin = time.time()
|
| 15 |
await asyncio.gather(*[client(i, interval_duration) for i in range(client_count)])
|
| 16 |
end = time.time()
|
| 17 |
+
return f"Total-duration: {round(end-begin,3)}, success: {success} out of {client_count}"
|
| 18 |
|
| 19 |
async def client(rank, interval_duration):
|
| 20 |
await asyncio.sleep(rank*interval_duration) # Server cannot handle a lot of instantanous conns
|
|
|
|
| 35 |
end = time.time()
|
| 36 |
duration = end - start
|
| 37 |
if jso["success"]:
|
| 38 |
+
success+=1
|
| 39 |
return
|
| 40 |
|
| 41 |
describe = f'Sends x number of events(requests) with y second intervals to the another space, https://huggingface.co/spaces/farukozderim/test-new-queue'
|