Spaces:
Build error
Build error
Update colorization.py
Browse files- colorization.py +5 -6
colorization.py
CHANGED
|
@@ -20,7 +20,7 @@ def colorize_image(image):
|
|
| 20 |
return f'./output/DeOldify/'+Path(image.name).stem+".png"
|
| 21 |
|
| 22 |
# def inference(img, version, scale, weight):
|
| 23 |
-
def inferenceColorize(img,
|
| 24 |
# weight /= 100
|
| 25 |
print(img, scale)
|
| 26 |
'''
|
|
@@ -56,21 +56,21 @@ def inferenceColorize(img, version, scale):
|
|
| 56 |
extension = 'png'
|
| 57 |
else:
|
| 58 |
extension = 'jpg'
|
| 59 |
-
|
| 60 |
os.makedirs('output', exist_ok=True)
|
| 61 |
model.predict(img.name)
|
| 62 |
save_path = f'output/DeOldify/'+Path(img.name).stem+'.{extension}'
|
| 63 |
|
| 64 |
-
|
| 65 |
cv2.imwrite(save_path, output)
|
| 66 |
output = cv2.cvtColor(output, cv2.COLOR_BGR2RGB)
|
| 67 |
-
|
| 68 |
return img, save_path
|
| 69 |
'''
|
| 70 |
except Exception as error:
|
| 71 |
print('global exception', error)
|
| 72 |
return None, None
|
| 73 |
-
'''
|
| 74 |
|
| 75 |
colorize = gr.Interface(
|
| 76 |
inferenceColorize, [
|
|
@@ -91,7 +91,6 @@ colorize = gr.Interface(
|
|
| 91 |
|
| 92 |
colorize.queue(concurrency_count=4)
|
| 93 |
colorize.launch()
|
| 94 |
-
|
| 95 |
'''
|
| 96 |
def create_interface():
|
| 97 |
with gr.Blocks() as enhancer:
|
|
|
|
| 20 |
return f'./output/DeOldify/'+Path(image.name).stem+".png"
|
| 21 |
|
| 22 |
# def inference(img, version, scale, weight):
|
| 23 |
+
def inferenceColorize(img, scale):
|
| 24 |
# weight /= 100
|
| 25 |
print(img, scale)
|
| 26 |
'''
|
|
|
|
| 56 |
extension = 'png'
|
| 57 |
else:
|
| 58 |
extension = 'jpg'
|
| 59 |
+
'''
|
| 60 |
os.makedirs('output', exist_ok=True)
|
| 61 |
model.predict(img.name)
|
| 62 |
save_path = f'output/DeOldify/'+Path(img.name).stem+'.{extension}'
|
| 63 |
|
| 64 |
+
'''
|
| 65 |
cv2.imwrite(save_path, output)
|
| 66 |
output = cv2.cvtColor(output, cv2.COLOR_BGR2RGB)
|
| 67 |
+
'''
|
| 68 |
return img, save_path
|
| 69 |
'''
|
| 70 |
except Exception as error:
|
| 71 |
print('global exception', error)
|
| 72 |
return None, None
|
| 73 |
+
'''
|
| 74 |
|
| 75 |
colorize = gr.Interface(
|
| 76 |
inferenceColorize, [
|
|
|
|
| 91 |
|
| 92 |
colorize.queue(concurrency_count=4)
|
| 93 |
colorize.launch()
|
|
|
|
| 94 |
'''
|
| 95 |
def create_interface():
|
| 96 |
with gr.Blocks() as enhancer:
|