lampongyuen commited on
Commit
3dc6831
·
1 Parent(s): a441d47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -22,7 +22,20 @@ def greet(image, name, is_morning, temperature):
22
  salutation = "Good morning" if is_morning else "Good evening"
23
  greeting = f"{salutation} {name}. It is {temperature} degrees today"
24
  celsius = (temperature - 32) * 5 / 9
25
- return image, greeting, round(celsius, 2)
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  demo = gr.Interface(
28
  fn=greet,
 
22
  salutation = "Good morning" if is_morning else "Good evening"
23
  greeting = f"{salutation} {name}. It is {temperature} degrees today"
24
  celsius = (temperature - 32) * 5 / 9
25
+
26
+ # contrast [1.0-3.0]
27
+ # brightness [0-100]
28
+ # https://docs.opencv.org/4.x/d3/dc1/tutorial_basic_linear_transform.html
29
+ in_contrast = 1.0
30
+ in_brightness = 50
31
+
32
+ for y in range(image.shape[0]):
33
+ for x in range(image.shape[1]):
34
+ for c in range(image.shape[2]):
35
+ new_image[y,x,c] = np.clip(in_contrast*image[y,x,c] + in_brightness, 0, 255)
36
+
37
+ return new_image, greeting, round(celsius, 2)
38
+
39
 
40
  demo = gr.Interface(
41
  fn=greet,