sahal-mulki commited on
Commit
4668af9
1 Parent(s): f0eb7ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -1,3 +1,15 @@
1
  import gradio as gr
 
2
 
3
- gr.Interface.load("models/sahal-mulki/spotting-diffusion").launch(server_port=8251)
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import socket
3
 
4
+ def next_free_port( port=1024, max_port=65535 ):
5
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
6
+ while port <= max_port:
7
+ try:
8
+ sock.bind(('', port))
9
+ sock.close()
10
+ return port
11
+ except OSError:
12
+ port += 1
13
+ raise IOError('no free ports')
14
+
15
+ gr.Interface.load("models/sahal-mulki/spotting-diffusion").launch(next_free_port())