Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -345,7 +345,7 @@ def process_image_menHair(background_image, x, y, placeholder_image_path, x_coor
|
|
| 345 |
placeholder_alpha = placeholder_image.split()[3] if placeholder_image.mode == 'RGBA' else None
|
| 346 |
|
| 347 |
# Function to generate Funko figurines
|
| 348 |
-
def
|
| 349 |
|
| 350 |
WomenHairStyle_classifier = WomenHairStyleClassifier('Data/FunkoSavedModels/WomenHairStyle.pt', ['MediumLength', 'ShortHair', 'SidePlait'])
|
| 351 |
predicted_WomenHairStyle = WomenHairStyle_classifier.classify_hairStyle(input_image)
|
|
@@ -480,14 +480,23 @@ def generate_funko_figurines(input_image):
|
|
| 480 |
imageComponent = gr.Image(type="filepath")
|
| 481 |
|
| 482 |
# Define Gradio input components
|
| 483 |
-
input_image = gr.Image(type="pil", label="Upload your image")
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
gr.
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
placeholder_alpha = placeholder_image.split()[3] if placeholder_image.mode == 'RGBA' else None
|
| 346 |
|
| 347 |
# Function to generate Funko figurines
|
| 348 |
+
def Igenerate_funko_figurines(input_image):
|
| 349 |
|
| 350 |
WomenHairStyle_classifier = WomenHairStyleClassifier('Data/FunkoSavedModels/WomenHairStyle.pt', ['MediumLength', 'ShortHair', 'SidePlait'])
|
| 351 |
predicted_WomenHairStyle = WomenHairStyle_classifier.classify_hairStyle(input_image)
|
|
|
|
| 480 |
imageComponent = gr.Image(type="filepath")
|
| 481 |
|
| 482 |
# Define Gradio input components
|
| 483 |
+
input_image = gr.inputs.Image(type="pil", label="Upload your image")
|
| 484 |
+
|
| 485 |
+
|
| 486 |
+
with gr.Blocks() as demo:
|
| 487 |
+
gr.Markdown(
|
| 488 |
+
"""
|
| 489 |
+
# Funko POP! Figurine Creation
|
| 490 |
+
Enabling Streamlined Automation with Generative Artificial Intelligence
|
| 491 |
+
""")
|
| 492 |
+
imageComponent = gr.Image(type="filepath").style(height=300, width=300)
|
| 493 |
+
#MyOutputs=[gr.Image(type="pil", label="Generated Image " + str(i + 1)) for i in range(3)]
|
| 494 |
+
with gr.Row():
|
| 495 |
+
MyOutputs = [gr.Image(type="pil", label="Generated Image " + str(i + 1)).style(height=300, width=300) for i in range(3)]
|
| 496 |
+
submitButton = gr.Button(value="Submit")
|
| 497 |
+
submitButton.click(Igenerate_funko_figurines, inputs=imageComponent, outputs=MyOutputs)
|
| 498 |
+
|
| 499 |
+
|
| 500 |
+
if __name__ == "__main__":
|
| 501 |
+
demo.launch()
|
| 502 |
+
|