Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,23 +40,7 @@ def crop_face(base64_image):
|
|
| 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")
|
| 47 |
-
img_str = base64.b64encode(buffered.getvalue()).decode()
|
| 48 |
-
return img_str
|
| 49 |
-
|
| 50 |
-
# Define the Gradio interfaces
|
| 51 |
-
base64_converter_interface = gr.Interface(
|
| 52 |
-
fn=image_to_base64,
|
| 53 |
-
inputs=gr.Image(type="pil"),
|
| 54 |
-
outputs=gr.Textbox(),
|
| 55 |
-
title="Image to Base64 Encoder",
|
| 56 |
-
description="Upload an image to convert it to a base64 encoded string."
|
| 57 |
-
)
|
| 58 |
-
|
| 59 |
-
face_crop_interface = gr.Interface(
|
| 60 |
fn=crop_face,
|
| 61 |
inputs=gr.Textbox(),
|
| 62 |
outputs="text",
|
|
@@ -65,4 +49,4 @@ face_crop_interface = gr.Interface(
|
|
| 65 |
)
|
| 66 |
|
| 67 |
if __name__ == "__main__":
|
| 68 |
-
|
|
|
|
| 40 |
except Exception as e:
|
| 41 |
return f"An error occurred: {str(e)}"
|
| 42 |
|
| 43 |
+
interface = gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
fn=crop_face,
|
| 45 |
inputs=gr.Textbox(),
|
| 46 |
outputs="text",
|
|
|
|
| 49 |
)
|
| 50 |
|
| 51 |
if __name__ == "__main__":
|
| 52 |
+
interface.launch(share=True)
|