Spaces:
Sleeping
Sleeping
import gradio as gr | |
import subprocess | |
def convert_image_to_dxf(image_path, output_path, debug_output): | |
try: | |
subprocess.run(["SimpleImageToDxfHavePass", "--use-lines", f"--imagePath={image_path}", f"--outputPath={output_path}", f"--debug-output={debug_output}"], check=True) | |
return f"DXF file saved to: {output_path}", debug_output | |
except subprocess.CalledProcessError as e: | |
return f"Error converting image to DXF: {e}", None | |
def main(): | |
with gr.Blocks() as demo: | |
gr.Markdown("# SimpleImageToDxfHavePass") | |
with gr.Row(): | |
image_input = gr.Image(label="Input Image") | |
dxf_output = gr.File(label="DXF Output") | |
with gr.Row(): | |
debug_output = gr.Image(label="Debug Output") | |
convert_btn = gr.Button("Convert to DXF") | |
convert_btn.click(convert_image_to_dxf, inputs=[image_input, dxf_output, debug_output], outputs=[dxf_output, debug_output]) | |
demo.launch() | |
if __name__ == "__main__": | |
main() |