File size: 946 Bytes
c0f2aea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import gradio as gr
from PIL import Image, ImageDraw

def detect_discrepancies(original, cnc_output):
    # If no original image is provided, simply return None.
    if original is None:
        return None

    # Create a copy of the original image for the output.
    img = original.copy()
    draw = ImageDraw.Draw(img)
    
    # Overlay text indicating discrepancy detection.
    text = "Discrepancy Detected"
    draw.text((10, 10), text, fill=(255, 0, 0))
    
    return img

interface = gr.Interface(
    fn=detect_discrepancies,
    inputs=[
        gr.Image(label="Original Image", type="pil"),
        gr.Image(label="CNC Plotted Image", type="pil")
    ],
    outputs=gr.Image(label="Discrepancy Visualization"),
    title="CNC Discrepancy Detector",
    description="Upload the original input image and the corresponding CNC plotted image to view the discrepancy visualization."
)

if __name__ == '__main__':
    interface.launch()