lsquaremaster commited on
Commit
e42b06e
1 Parent(s): 63ec576

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -6,6 +6,7 @@ import numpy as np
6
 
7
  model = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')
8
 
 
9
  def style_transfer(content_img, style_img):
10
  content_img = tf.image.resize(tf.convert_to_tensor(content_img,tf.float32)[tf.newaxis,...] / 255.,(512,512),preserve_aspect_ratio=True)
11
  style_img = tf.convert_to_tensor(style_img,tf.float32)[tf.newaxis,...] / 255.
@@ -14,12 +15,20 @@ def style_transfer(content_img, style_img):
14
  return Image.fromarray(np.uint8(generated_img[0]*255))
15
 
16
 
 
17
  title = "Neural Style Transfer"
 
 
 
 
 
18
 
19
  interface = gr.Interface(fn=style_transfer,
20
  inputs=["image", "image"],
21
  outputs=["image"],
22
- title=title
 
 
23
  )
24
 
25
  interface.launch()
 
6
 
7
  model = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')
8
 
9
+ # Function to execute
10
  def style_transfer(content_img, style_img):
11
  content_img = tf.image.resize(tf.convert_to_tensor(content_img,tf.float32)[tf.newaxis,...] / 255.,(512,512),preserve_aspect_ratio=True)
12
  style_img = tf.convert_to_tensor(style_img,tf.float32)[tf.newaxis,...] / 255.
 
15
  return Image.fromarray(np.uint8(generated_img[0]*255))
16
 
17
 
18
+ # Metadata
19
  title = "Neural Style Transfer"
20
+ description = "Transform your photos into stunning works of art with our Neural Style Transfer app. Simply upload your content image and style image, and watch as the AI-powered model applies the artistic style of your choice to your photos. Unleash your creativity and turn ordinary images into extraordinary masterpieces!"
21
+
22
+ # Define labels for the input images
23
+ input_labels = ["Content/Base Image", "Style Image"]
24
+
25
 
26
  interface = gr.Interface(fn=style_transfer,
27
  inputs=["image", "image"],
28
  outputs=["image"],
29
+ input_labels=input_labels,
30
+ title=title,
31
+ description=description
32
  )
33
 
34
  interface.launch()