Spaces:
Sleeping
Sleeping
| 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() | |