jithenderchoudary commited on
Commit
b5f490a
·
verified ·
1 Parent(s): 2ffc08a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -133,5 +133,11 @@ def main():
133
 
134
  if __name__ == "__main__":
135
  app = main()
136
- port = int(os.environ.get("GRADIO_SERVER_PORT", 7861)) # Default to 7861
137
- app.launch(server_port=port, debug=True)
 
 
 
 
 
 
 
133
 
134
  if __name__ == "__main__":
135
  app = main()
136
+ try:
137
+ # Automatically find an available port in the range 7860-7870
138
+ port = find_free_port(7860, 7870)
139
+ print(f"Launching on port: {port}")
140
+ app.launch(server_port=port, debug=True)
141
+ except Exception as e:
142
+ print(f"Failed to launch: {str(e)}")
143
+