Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
·
8f9a0bc
1
Parent(s):
46c8e4c
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ import torchtext
|
|
12 |
from stat import ST_CTIME
|
13 |
from datetime import datetime, timedelta
|
14 |
import shutil
|
15 |
-
torch.hub.download_url_to_file('https://i.imgur.com/
|
16 |
# Images
|
17 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2021/08/04/14/16/tower-6521842_1280.jpg', 'tower.jpg')
|
18 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2017/08/31/05/36/buildings-2699520_1280.jpg', 'city.jpg')
|
@@ -490,7 +490,7 @@ inferences_running = 0
|
|
490 |
def throttled_inference(image):
|
491 |
global inferences_running
|
492 |
current = inferences_running
|
493 |
-
if current >=
|
494 |
print(f"Rejected inference when we already had {current} running")
|
495 |
return "gpu.jpg",Image.open("gpu.jpg")
|
496 |
print(f"Inference starting when we already had {current} running")
|
|
|
12 |
from stat import ST_CTIME
|
13 |
from datetime import datetime, timedelta
|
14 |
import shutil
|
15 |
+
torch.hub.download_url_to_file('https://i.imgur.com/tXrot31.jpg', 'gpu.jpg')
|
16 |
# Images
|
17 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2021/08/04/14/16/tower-6521842_1280.jpg', 'tower.jpg')
|
18 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2017/08/31/05/36/buildings-2699520_1280.jpg', 'city.jpg')
|
|
|
490 |
def throttled_inference(image):
|
491 |
global inferences_running
|
492 |
current = inferences_running
|
493 |
+
if current >= 5:
|
494 |
print(f"Rejected inference when we already had {current} running")
|
495 |
return "gpu.jpg",Image.open("gpu.jpg")
|
496 |
print(f"Inference starting when we already had {current} running")
|