Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -46,17 +46,17 @@ def crop_face(base64_image):
|
|
46 |
|
47 |
def image_to_base64(image):
|
48 |
try:
|
49 |
-
# Prepare the buffer to save the image
|
50 |
buffered = BytesIO()
|
51 |
-
# Save the image to the buffer in JPEG format
|
52 |
image.save(buffered, format="JPEG")
|
53 |
-
# Encode the buffered image to Base64
|
54 |
img_str = base64.b64encode(buffered.getvalue()).decode('utf-8')
|
|
|
55 |
return img_str
|
56 |
except Exception as e:
|
|
|
57 |
return f"An error occurred: {str(e)}"
|
58 |
|
59 |
|
|
|
60 |
# Define the Gradio interfaces
|
61 |
face_crop_interface = gr.Interface(
|
62 |
fn=crop_face,
|
|
|
46 |
|
47 |
def image_to_base64(image):
|
48 |
try:
|
|
|
49 |
buffered = BytesIO()
|
|
|
50 |
image.save(buffered, format="JPEG")
|
|
|
51 |
img_str = base64.b64encode(buffered.getvalue()).decode('utf-8')
|
52 |
+
print("Encoded String:", img_str[:100]) # Print the first 100 characters
|
53 |
return img_str
|
54 |
except Exception as e:
|
55 |
+
print("Error:", str(e))
|
56 |
return f"An error occurred: {str(e)}"
|
57 |
|
58 |
|
59 |
+
|
60 |
# Define the Gradio interfaces
|
61 |
face_crop_interface = gr.Interface(
|
62 |
fn=crop_face,
|