Sanket
commited on
Commit
·
bcdd461
1
Parent(s):
baa2bd3
darken image
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
import torch.nn as nn
|
4 |
import torchvision.transforms as transforms
|
5 |
-
from PIL import Image
|
6 |
|
7 |
norm_layer = nn.InstanceNorm2d
|
8 |
|
@@ -117,7 +117,10 @@ def predict(input_img, ver):
|
|
117 |
drawing = model1(input_img)[0].detach()
|
118 |
|
119 |
drawing = transforms.ToPILImage()(drawing)
|
120 |
-
|
|
|
|
|
|
|
121 |
|
122 |
|
123 |
title = "Image to Line Drawings - Complex and Simple Portraits and Landscapes"
|
|
|
2 |
import torch
|
3 |
import torch.nn as nn
|
4 |
import torchvision.transforms as transforms
|
5 |
+
from PIL import Image, ImageEnhance
|
6 |
|
7 |
norm_layer = nn.InstanceNorm2d
|
8 |
|
|
|
117 |
drawing = model1(input_img)[0].detach()
|
118 |
|
119 |
drawing = transforms.ToPILImage()(drawing)
|
120 |
+
enhancer = ImageEnhance.Brightness(drawing)
|
121 |
+
factor = 0.6 # darkens the image
|
122 |
+
im_output = enhancer.enhance(factor)
|
123 |
+
return im_output
|
124 |
|
125 |
|
126 |
title = "Image to Line Drawings - Complex and Simple Portraits and Landscapes"
|