nightfury commited on
Commit
83939f5
·
1 Parent(s): b326d68

Update colorization.py

Browse files
Files changed (1) hide show
  1. colorization.py +13 -14
colorization.py CHANGED
@@ -66,29 +66,27 @@ output = cv2.cvtColor(output, cv2.COLOR_BGR2RGB)
66
 
67
 
68
 
69
- demo = gr.Interface(
70
  inference, [
71
- gr.inputs.Image(type="filepath", label="Input"),
72
- # gr.inputs.Radio(['v1.2', 'v1.3', 'v1.4', 'RestoreFormer', 'CodeFormer'], type="value", default='v1.4', label='version'),
73
- gr.inputs.Radio(['v1.2', 'v1.3', 'v1.4', 'RestoreFormer','CodeFormer','RealESR-General-x4v3'], type="value", default='v1.4', label='version'),
74
  gr.inputs.Number(label="Rescaling factor", default=2),
 
 
75
  # gr.Slider(0, 100, label='Weight, only for CodeFormer. 0 for better quality, 100 for better identity', default=50)
76
  ], [
77
- gr.outputs.Image(type="numpy", label="Output (The whole image)"),
78
- gr.outputs.File(label="Download the output image")
79
  ],
80
  title=title,
81
  description=description,
82
  article=article,
83
- # examples=[['AI-generate.jpg', 'v1.4', 2, 50], ['lincoln.jpg', 'v1.4', 2, 50], ['Blake_Lively.jpg', 'v1.4', 2, 50],
84
- # ['10045.png', 'v1.4', 2, 50]]).launch()
85
- examples=[['a1.jpg', 'v1.4', 2], ['a2.jpg', 'v1.4', 2], ['a3.jpg', 'v1.4', 2],['a4.jpg', 'v1.4', 2]])
86
 
87
- demo.queue(concurrency_count=4)
88
- demo.launch()
89
-
90
-
91
 
 
92
  def create_interface():
93
  with gr.Blocks() as enhancer:
94
  gr.Markdown("Colorize old black & white photos")
@@ -104,4 +102,5 @@ def run_code():
104
  create_interface()
105
 
106
  # The main function
107
- run_code()
 
 
66
 
67
 
68
 
69
+ colorize = gr.Interface(
70
  inference, [
71
+ gr.Markdown("Colorize old black & white photos"),
72
+ gr.Image(type="filepath", label="Input"),
73
+
74
  gr.inputs.Number(label="Rescaling factor", default=2),
75
+ gr.Button("Upscale & Colorize!")
76
+
77
  # gr.Slider(0, 100, label='Weight, only for CodeFormer. 0 for better quality, 100 for better identity', default=50)
78
  ], [
79
+ gr.outputs.Image(type="numpy", label="Output (The colorized image)"),
80
+ gr.outputs.File(label="Download the colorized image")
81
  ],
82
  title=title,
83
  description=description,
84
  article=article,
 
 
 
85
 
86
+ colorize.queue(concurrency_count=4)
87
+ colorize.launch()
 
 
88
 
89
+ '''
90
  def create_interface():
91
  with gr.Blocks() as enhancer:
92
  gr.Markdown("Colorize old black & white photos")
 
102
  create_interface()
103
 
104
  # The main function
105
+ run_code()
106
+ '''