Sanjayraju30 commited on
Commit
6e5b0a0
·
verified ·
1 Parent(s): 422e299

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -28
app.py CHANGED
@@ -1,32 +1,18 @@
1
  import gradio as gr
2
- import cv2
3
- from services.video_service import get_video_frame
4
- from services.detection_service import detect_objects
5
- from services.thermal_service import detect_thermal_anomalies
6
- from services.shadow_detection import detect_shadow_coverage
7
- from services.salesforce_dispatcher import send_to_salesforce
8
 
9
- frame_gen = get_video_frame("data/drone_day.mp4")
 
 
10
 
11
- def monitor_feed():
12
- try:
13
- frame = next(frame_gen)
14
- cv2.imwrite("temp.jpg", frame)
15
- detections = detect_objects("temp.jpg")
16
- thermal = detect_thermal_anomalies("temp.jpg")
17
- shadow_flag = detect_shadow_coverage("temp.jpg")
18
-
19
- alert_payload = {
20
- "detections": detections,
21
- "thermal": bool(thermal),
22
- "shadow_issue": shadow_flag,
23
- }
24
- send_to_salesforce(alert_payload)
25
- return frame
26
- except StopIteration:
27
-
28
- return None
29
-
30
- iface = gr.Interface(fn=monitor_feed, inputs=[], outputs="image", live=True, title="Solar
31
- Surveillance Feed Simulation")
32
 
 
 
 
1
  import gradio as gr
2
+ from utils.detector import detect_faults
3
+ from PIL import Image
 
 
 
 
4
 
5
+ def analyze_image(image):
6
+ results = detect_faults(image)
7
+ return results
8
 
9
+ demo = gr.Interface(
10
+ fn=analyze_image,
11
+ inputs=gr.Image(type="pil"),
12
+ outputs="json",
13
+ title="VIEP Smart Pole Fault Detection",
14
+ description="Upload a surveillance image to detect faults like intrusion, overheating, or dust/shade issues."
15
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ if __name__ == "__main__":
18
+ demo.launch()