Spaces:
Sleeping
Sleeping
fix: disable SSR, add @spaces.GPU decorator for Zero GPU
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import io
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
import torch
|
| 4 |
import gradio as gr
|
|
@@ -95,6 +96,7 @@ def process_image(image: Image.Image):
|
|
| 95 |
return mask_img, depth_img
|
| 96 |
|
| 97 |
|
|
|
|
| 98 |
def predict(image):
|
| 99 |
mask, depth = process_image(image)
|
| 100 |
return mask, depth
|
|
@@ -114,4 +116,4 @@ with gr.Blocks() as demo:
|
|
| 114 |
btn.click(fn=predict, inputs=input_image, outputs=[mask_output, depth_output])
|
| 115 |
|
| 116 |
if __name__ == "__main__":
|
| 117 |
-
demo.launch()
|
|
|
|
| 1 |
import io
|
| 2 |
+
import spaces
|
| 3 |
import numpy as np
|
| 4 |
import torch
|
| 5 |
import gradio as gr
|
|
|
|
| 96 |
return mask_img, depth_img
|
| 97 |
|
| 98 |
|
| 99 |
+
@spaces.GPU
|
| 100 |
def predict(image):
|
| 101 |
mask, depth = process_image(image)
|
| 102 |
return mask, depth
|
|
|
|
| 116 |
btn.click(fn=predict, inputs=input_image, outputs=[mask_output, depth_output])
|
| 117 |
|
| 118 |
if __name__ == "__main__":
|
| 119 |
+
demo.launch(ssr_mode=False)
|