syedaoon commited on
Commit
2bf5132
Β·
verified Β·
1 Parent(s): aff2f7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -14
app.py CHANGED
@@ -2,24 +2,44 @@ import gradio as gr
2
  from PIL import Image
3
  import numpy as np
4
 
5
- print("πŸš€ ZeroIG - Simple Version")
6
 
7
  def enhance_image(image):
8
- """Simple image enhancement"""
9
  if image is None:
10
- return None
 
 
 
11
 
12
- # Just do simple brightness enhancement for now
13
- arr = np.array(image).astype(np.float32)
14
- enhanced = np.clip(arr * 2.0, 0, 255).astype(np.uint8)
15
- return Image.fromarray(enhanced)
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- # Create interface with ANCIENT API
18
- interface = gr.Interface(
19
- enhance_image,
20
- "image",
21
- "image",
22
- title="ZeroIG Enhancement"
 
23
  )
24
 
25
- interface.launch(share=True)
 
 
 
 
 
2
  from PIL import Image
3
  import numpy as np
4
 
5
+ print("πŸš€ Starting bulletproof ZeroIG...")
6
 
7
  def enhance_image(image):
8
+ """Super simple image enhancement"""
9
  if image is None:
10
+ # Return a simple test image if no input
11
+ arr = np.zeros((400, 400, 3), dtype=np.uint8)
12
+ arr.fill(128) # Gray image
13
+ return Image.fromarray(arr)
14
 
15
+ try:
16
+ # Convert PIL to numpy
17
+ arr = np.array(image)
18
+
19
+ # Simple brightness boost
20
+ enhanced = np.clip(arr.astype(np.float32) * 1.5, 0, 255).astype(np.uint8)
21
+
22
+ # Convert back to PIL
23
+ return Image.fromarray(enhanced)
24
+
25
+ except Exception as e:
26
+ print(f"Error in enhance_image: {e}")
27
+ # Return original image if anything fails
28
+ return image
29
+
30
+ print("Creating interface...")
31
 
32
+ # Ultra simple interface
33
+ demo = gr.Interface(
34
+ fn=enhance_image,
35
+ inputs=gr.Image(type="pil", label="Upload Image"),
36
+ outputs=gr.Image(type="pil", label="Enhanced Image"),
37
+ title="ZeroIG Image Enhancement",
38
+ description="Upload an image to make it brighter!"
39
  )
40
 
41
+ print("Launching interface...")
42
+
43
+ # Simple launch without share parameter
44
+ if __name__ == "__main__":
45
+ demo.launch()