Spaces:
Sleeping
Sleeping
jovian
commited on
Commit
·
5d402f3
1
Parent(s):
696f1e8
login
Browse files
app.py
CHANGED
|
@@ -6,7 +6,6 @@ from sahi import AutoDetectionModel
|
|
| 6 |
from PIL import Image
|
| 7 |
import plotly.graph_objects as go
|
| 8 |
import torch
|
| 9 |
-
import spaces
|
| 10 |
import os
|
| 11 |
|
| 12 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
@@ -211,7 +210,6 @@ def upload_image(image):
|
|
| 211 |
"""Process the uploaded image (if needed) and display it."""
|
| 212 |
return image
|
| 213 |
|
| 214 |
-
@spaces.GPU
|
| 215 |
def apply_detection(image):
|
| 216 |
"""Run object detection on the uploaded image and return the annotated image."""
|
| 217 |
# Convert image from PIL to NumPy array
|
|
@@ -429,8 +427,6 @@ with gr.Blocks(css = css,js=js_func) as demo:
|
|
| 429 |
username = os.getenv("USERNAME")
|
| 430 |
password = os.getenv("PASSWORD")
|
| 431 |
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
else:
|
| 435 |
-
print("Environment variables USERNAME and PASSWORD are not set.")
|
| 436 |
|
|
|
|
| 6 |
from PIL import Image
|
| 7 |
import plotly.graph_objects as go
|
| 8 |
import torch
|
|
|
|
| 9 |
import os
|
| 10 |
|
| 11 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 210 |
"""Process the uploaded image (if needed) and display it."""
|
| 211 |
return image
|
| 212 |
|
|
|
|
| 213 |
def apply_detection(image):
|
| 214 |
"""Run object detection on the uploaded image and return the annotated image."""
|
| 215 |
# Convert image from PIL to NumPy array
|
|
|
|
| 427 |
username = os.getenv("USERNAME")
|
| 428 |
password = os.getenv("PASSWORD")
|
| 429 |
|
| 430 |
+
demo.launch(share=True, auth=(username, password))
|
| 431 |
+
|
|
|
|
|
|
|
| 432 |
|