Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,9 @@ import cv2
|
|
| 4 |
import gradio as gr
|
| 5 |
from PIL import Image
|
| 6 |
from io import BytesIO
|
|
|
|
| 7 |
|
|
|
|
| 8 |
def crop_face(base64_image):
|
| 9 |
try:
|
| 10 |
# Decode the base64 image to an OpenCV format
|
|
@@ -38,6 +40,7 @@ def crop_face(base64_image):
|
|
| 38 |
except Exception as e:
|
| 39 |
return f"An error occurred: {str(e)}"
|
| 40 |
|
|
|
|
| 41 |
def image_to_base64(image):
|
| 42 |
buffered = BytesIO()
|
| 43 |
image.save(buffered, format="JPEG")
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
from PIL import Image
|
| 6 |
from io import BytesIO
|
| 7 |
+
import spaces
|
| 8 |
|
| 9 |
+
@spaces.GPU
|
| 10 |
def crop_face(base64_image):
|
| 11 |
try:
|
| 12 |
# Decode the base64 image to an OpenCV format
|
|
|
|
| 40 |
except Exception as e:
|
| 41 |
return f"An error occurred: {str(e)}"
|
| 42 |
|
| 43 |
+
|
| 44 |
def image_to_base64(image):
|
| 45 |
buffered = BytesIO()
|
| 46 |
image.save(buffered, format="JPEG")
|