koesan commited on
Commit
6d63489
·
1 Parent(s): 3ff5184

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -1,10 +1,16 @@
1
  import gradio as gr
2
  import numpy as np
 
 
3
  import matplotlib.pyplot as plt
4
  from matplotlib.patches import Rectangle
5
  from heapq import heappush, heappop
6
  import io
7
  from PIL import Image
 
 
 
 
8
 
9
  # Grid tanımı
10
  GRID = [[4, 4, 4, 4, 4, 4, 4, 2, 3, 2, 4, 2],
@@ -268,17 +274,10 @@ with gr.Blocks(title="Path Finding Algorithms", theme=gr.themes.Soft()) as demo:
268
  inputs=[start_x, start_y, goal_x, goal_y, algorithm],
269
  outputs=output_image
270
  )
271
-
272
- # İlk yükleme
273
- demo.load(
274
- fn=visualize_path,
275
- inputs=[gr.Number(value=0, visible=False),
276
- gr.Number(value=7, visible=False),
277
- gr.Number(value=11, visible=False),
278
- gr.Number(value=0, visible=False),
279
- gr.Textbox(value="A*", visible=False)],
280
- outputs=output_image
281
- )
282
 
283
  if __name__ == "__main__":
284
- demo.launch()
 
 
 
 
 
1
  import gradio as gr
2
  import numpy as np
3
+ import matplotlib
4
+ matplotlib.use('Agg') # Non-interactive backend for server
5
  import matplotlib.pyplot as plt
6
  from matplotlib.patches import Rectangle
7
  from heapq import heappush, heappop
8
  import io
9
  from PIL import Image
10
+ import os
11
+
12
+ # Matplotlib config directory
13
+ os.environ['MPLCONFIGDIR'] = '/tmp/matplotlib'
14
 
15
  # Grid tanımı
16
  GRID = [[4, 4, 4, 4, 4, 4, 4, 2, 3, 2, 4, 2],
 
274
  inputs=[start_x, start_y, goal_x, goal_y, algorithm],
275
  outputs=output_image
276
  )
 
 
 
 
 
 
 
 
 
 
 
277
 
278
  if __name__ == "__main__":
279
+ demo.launch(
280
+ server_name="0.0.0.0",
281
+ server_port=7860,
282
+ share=False
283
+ )