tosin2013 commited on
Commit
f9da279
·
verified ·
1 Parent(s): e3d82b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -18
app.py CHANGED
@@ -343,23 +343,7 @@ with gr.Blocks() as demo:
343
  )
344
  print("[CHAT] Clear button handler configured")
345
 
346
- import socket
347
-
348
- def find_available_port(start_port=7860, end_port=7900):
349
- for port in range(start_port, end_port + 1):
350
- with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
351
- try:
352
- s.bind(('', port))
353
- return port
354
- except OSError:
355
- continue
356
- raise OSError(f"No available ports between {start_port} and {end_port}")
357
 
358
  if __name__ == "__main__":
359
- try:
360
- port = find_available_port()
361
- print(f"[LOG] Launching application on port {port}")
362
- print("[CHAT] Starting chat server...")
363
- demo.launch()
364
- except Exception as e:
365
- print(f"[ERROR] Failed to start application: {str(e)}")
 
343
  )
344
  print("[CHAT] Clear button handler configured")
345
 
 
 
 
 
 
 
 
 
 
 
 
346
 
347
  if __name__ == "__main__":
348
+ demo.launch()
349
+