Update app.py
Browse files
app.py
CHANGED
|
@@ -90,10 +90,7 @@ def transform_my_model(content_image, style_image):
|
|
| 90 |
logger.error(f"Error in transform_my_model: {str(e)}")
|
| 91 |
raise
|
| 92 |
|
| 93 |
-
# Create
|
| 94 |
-
os.makedirs("examples", exist_ok=True)
|
| 95 |
-
|
| 96 |
-
# Create the Gradio interface with minimal configuration
|
| 97 |
demo = gr.Interface(
|
| 98 |
fn=transform_my_model,
|
| 99 |
inputs=[
|
|
@@ -102,14 +99,34 @@ demo = gr.Interface(
|
|
| 102 |
],
|
| 103 |
outputs=gr.Image(type="pil", label="Result"),
|
| 104 |
title="Neural Style Transfer",
|
| 105 |
-
description="
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
)
|
| 109 |
|
|
|
|
| 110 |
if __name__ == "__main__":
|
| 111 |
demo.launch(
|
| 112 |
server_name="0.0.0.0",
|
| 113 |
server_port=7860,
|
| 114 |
-
share=
|
| 115 |
)
|
|
|
|
| 90 |
logger.error(f"Error in transform_my_model: {str(e)}")
|
| 91 |
raise
|
| 92 |
|
| 93 |
+
# Create the Gradio interface with Hugging Face Spaces configuration
|
|
|
|
|
|
|
|
|
|
| 94 |
demo = gr.Interface(
|
| 95 |
fn=transform_my_model,
|
| 96 |
inputs=[
|
|
|
|
| 99 |
],
|
| 100 |
outputs=gr.Image(type="pil", label="Result"),
|
| 101 |
title="Neural Style Transfer",
|
| 102 |
+
description="""
|
| 103 |
+
## Neural Style Transfer
|
| 104 |
+
Upload a content image and a style image to create a stylized version of your content image.
|
| 105 |
+
|
| 106 |
+
### How to use:
|
| 107 |
+
1. Upload your content image (the image you want to style)
|
| 108 |
+
2. Upload your style image (the image whose style you want to apply)
|
| 109 |
+
3. Click 'Submit' and wait for the result
|
| 110 |
+
|
| 111 |
+
### Tips:
|
| 112 |
+
- For best results, use clear, high-quality images
|
| 113 |
+
- The style image's characteristics will be transferred to your content image
|
| 114 |
+
- Processing may take a few seconds depending on image size
|
| 115 |
+
""",
|
| 116 |
+
examples=[
|
| 117 |
+
["Content_Images/contnt12.jpg", "VG516.jpg"],
|
| 118 |
+
["Content_Images/contnt2.jpg", "Content_Images/styl9.jpg"],
|
| 119 |
+
["Content_Images/contnt.jpg", "Content_Images/styl22.jpg"]
|
| 120 |
+
],
|
| 121 |
+
cache_examples=True,
|
| 122 |
+
allow_flagging=False,
|
| 123 |
+
analytics_enabled=False
|
| 124 |
)
|
| 125 |
|
| 126 |
+
# For Hugging Face Spaces deployment
|
| 127 |
if __name__ == "__main__":
|
| 128 |
demo.launch(
|
| 129 |
server_name="0.0.0.0",
|
| 130 |
server_port=7860,
|
| 131 |
+
share=False # Set to False for Hugging Face Spaces
|
| 132 |
)
|