Sa-m commited on
Commit
5b908f1
1 Parent(s): 61f6ed6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -67,12 +67,12 @@ def gray_scaled(inp_img):
67
 
68
  def transform_mymodel(content_image,style_image):
69
  # Convert to float32 numpy array, add batch dimension, and normalize to range [0, 1]
70
- content_image=gray_scaled(content_image)
71
  content_image = content_image.astype(np.float32)[np.newaxis, ...] / 255.0
72
  style_image = style_image.astype(np.float32)[np.newaxis, ...] / 255.0
73
 
74
  #Resizing image
75
- style_image = tf.image.resize(style_image, (256, 256))
76
 
77
  # Stylize image
78
  outputs = model(tf.constant(content_image), tf.constant(style_image))
@@ -87,7 +87,7 @@ def gradio_intrface(mymodel):
87
  image1 = gr.inputs.Image() #CONTENT IMAGE
88
  image2 = gr.inputs.Image() #STYLE IMAGE
89
  stylizedimg=gr.outputs.Image()
90
- gr.Interface(fn=mymodel, inputs= [image1,image2] , outputs= stylizedimg,title='Style Transfer',theme='seafoam',examples=[['Content_Images/contnt12.jpg','VG516.jpg']]).launch()
91
 
92
  """The function will be launched both Inline and Outline where u need to add a content and style image."""
93
 
 
67
 
68
  def transform_mymodel(content_image,style_image):
69
  # Convert to float32 numpy array, add batch dimension, and normalize to range [0, 1]
70
+ #content_image=gray_scaled(content_image)
71
  content_image = content_image.astype(np.float32)[np.newaxis, ...] / 255.0
72
  style_image = style_image.astype(np.float32)[np.newaxis, ...] / 255.0
73
 
74
  #Resizing image
75
+ #style_image = tf.image.resize(style_image, (256, 256))
76
 
77
  # Stylize image
78
  outputs = model(tf.constant(content_image), tf.constant(style_image))
 
87
  image1 = gr.inputs.Image() #CONTENT IMAGE
88
  image2 = gr.inputs.Image() #STYLE IMAGE
89
  stylizedimg=gr.outputs.Image()
90
+ gr.Interface(fn=mymodel, inputs= [image1,image2] , outputs= stylizedimg,title='Style Transfer',theme='seafoam',examples=[['Content_Images/contnt12.jpg','VG516.jpg']],article="**References**\n\n""<a href='https://www.tensorflow.org/hub/tutorials/tf2_arbitrary_image_stylization'</a>\n").launch()
91
 
92
  """The function will be launched both Inline and Outline where u need to add a content and style image."""
93