Deepakraj2006/CNC_PROJECT
0
1import gradio as gr2from PIL import Image, ImageDraw3 4def detect_discrepancies(original, cnc_output):5 # If no original image is provided, simply return None.6 if original is None:7 return None8 9 # Create a copy of the original image for the output.10 img = original.copy()11 draw = ImageDraw.Draw(img)12 13 # Overlay text indicating discrepancy detection.14 text = "Discrepancy Detected"15 draw.text((10, 10), text, fill=(255, 0, 0))16 17 return img18 19interface = gr.Interface(20 fn=detect_discrepancies,21 inputs=[22 gr.Image(label="Original Image", type="pil"),23 gr.Image(label="CNC Plotted Image", type="pil")24 ],25 outputs=gr.Image(label="Discrepancy Visualization"),26 title="CNC Discrepancy Detector",27 description="Upload the original input image and the corresponding CNC plotted image to view the discrepancy visualization."28)29 30if __name__ == '__main__':31 interface.launch()32 