Geek7 commited on
Commit
217b79d
·
verified ·
1 Parent(s): f53f5ad

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from neural_style_transfer import NeuralStyleTransfer
3
+
4
+ def style_transfer(content_image, style_image):
5
+ # Initialize the neural style transfer model
6
+ nst = NeuralStyleTransfer(content_image, style_image)
7
+
8
+ # Generate the stylized image
9
+ output_image = nst.transfer_style()
10
+
11
+ return output_image
12
+
13
+ # Gradio interface setup
14
+ iface = gr.Interface(
15
+ fn=style_transfer,
16
+ inputs=[
17
+ gr.Image(type="pil", label="Content Image"),
18
+ gr.Image(type="pil", label="Style Image")
19
+ ],
20
+ outputs=gr.Image(label="Stylized Image"),
21
+ title="Neural Style Transfer",
22
+ description="Upload a content image and a style image to apply neural style transfer."
23
+ )
24
+
25
+ if __name__ == "__main__":
26
+ iface.launch()