Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,31 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from PIL import Image
|
| 3 |
-
import os
|
| 4 |
-
# Import your core functions (estimate_pose, segment_clothing, inpaint_clothing, change_clothing) from your main script
|
| 5 |
-
from main_code_script import change_clothing # Replace your_main_script
|
| 6 |
-
def predict(image_path, garment_image_path): # Changed input
|
| 7 |
-
"""
|
| 8 |
-
The prediction function for Gradio.
|
| 9 |
-
"""
|
| 10 |
-
try:
|
| 11 |
-
modified_image = change_clothing(image_path, garment_image_path) # Changed input
|
| 12 |
-
if modified_image:
|
| 13 |
-
return modified_image
|
| 14 |
-
else:
|
| 15 |
-
return "Failed to change clothing. Please check the images."
|
| 16 |
-
except Exception as e:
|
| 17 |
-
return f"Error: {e}"
|
| 18 |
-
# Create the Gradio interface
|
| 19 |
-
iface = gr.Interface(
|
| 20 |
-
fn=predict,
|
| 21 |
-
inputs=[
|
| 22 |
-
gr.Image(type="filepath", label="Input Image (Person)"), # Changed label
|
| 23 |
-
gr.Image(type="filepath", label="Garment Image"), # Added input
|
| 24 |
-
],
|
| 25 |
-
outputs=gr.Image(type="pil", label="Modified Image"),
|
| 26 |
-
title="AI Clothing Changer",
|
| 27 |
-
description="Try on different clothes with AI by uploading a garment image!", # Changed description
|
| 28 |
-
)
|
| 29 |
-
# Launch the Gradio interface
|
| 30 |
-
if __name__ == "__main__":
|
| 31 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|