Can Günen commited on
Commit
6c4c864
·
1 Parent(s): dadc84c

Fixed the .yml file display problem in the second tab

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -29,7 +29,6 @@ def get_select_coords(img, evt: gr.SelectData):
29
 
30
  row, col = evt.index
31
  coordis.append([row, col])
32
- selected_coords.value = f"Selected Coordinates: ({row}, {col})"
33
 
34
  if len(coordis) == 4 :
35
  coordinates = np.array(coordis)
@@ -44,10 +43,10 @@ def get_select_coords(img, evt: gr.SelectData):
44
  msp.add_line((coordinates[2][0], -coordinates[2][1]), (coordinates[3][0], -coordinates[3][1]))
45
  msp.add_line((coordinates[3][0], -coordinates[3][1]), (coordinates[0][0], -coordinates[0][1]))
46
 
47
- dwg.saveas("output.dxf")
48
  coordis.clear()
49
 
50
- return "DXF File has been saved successfully"
51
 
52
 
53
  SHARED_UI_WARNING = f'''##### Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus dignissim odio, at elementum erat vulputate sit amet. Vestibulum sodales viverra fermentum. In ac hendrerit dolor, vitae mattis odio. Maecenas suscipit consectetur suscipit. Curabitur sodales dui eget neque venenatis tincidunt. In sed libero mi. Nam sollicitudin metus urna, sit amet sagittis ex laoreet sed.
@@ -86,9 +85,9 @@ with gr.Blocks() as demo:
86
  title = """<p><h1 align="center" style="font-size: 24px;">Then, let's mark the corners of the Workpiece</h1></p>"""
87
  gr.HTML(title)
88
  corrected_img = gr.Image(label="Corrected Image")
89
- selected_coords = gr.Textbox()
90
 
91
- corrected_img.select(get_select_coords, [corrected_img], selected_coords)
92
  correct_button.click(fn=correct_image, inputs=[distorted_input, yml_input], outputs=corrected_img)
93
 
94
  with gr.Tab("O-Matrix"):
 
29
 
30
  row, col = evt.index
31
  coordis.append([row, col])
 
32
 
33
  if len(coordis) == 4 :
34
  coordinates = np.array(coordis)
 
43
  msp.add_line((coordinates[2][0], -coordinates[2][1]), (coordinates[3][0], -coordinates[3][1]))
44
  msp.add_line((coordinates[3][0], -coordinates[3][1]), (coordinates[0][0], -coordinates[0][1]))
45
 
46
+ dwg_file = dwg.saveas("output.dxf")
47
  coordis.clear()
48
 
49
+ return "output.dxf"
50
 
51
 
52
  SHARED_UI_WARNING = f'''##### Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus dignissim odio, at elementum erat vulputate sit amet. Vestibulum sodales viverra fermentum. In ac hendrerit dolor, vitae mattis odio. Maecenas suscipit consectetur suscipit. Curabitur sodales dui eget neque venenatis tincidunt. In sed libero mi. Nam sollicitudin metus urna, sit amet sagittis ex laoreet sed.
 
85
  title = """<p><h1 align="center" style="font-size: 24px;">Then, let's mark the corners of the Workpiece</h1></p>"""
86
  gr.HTML(title)
87
  corrected_img = gr.Image(label="Corrected Image")
88
+ dxf_output = gr.File(type="file")
89
 
90
+ corrected_img.select(get_select_coords, [corrected_img], dxf_output)
91
  correct_button.click(fn=correct_image, inputs=[distorted_input, yml_input], outputs=corrected_img)
92
 
93
  with gr.Tab("O-Matrix"):