Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -572,27 +572,4 @@ with gr.Blocks(title="Social Media Addiction Analysis - Comprehensive", theme=gr
|
|
| 572 |
|
| 573 |
# Launch the app
|
| 574 |
if __name__ == "__main__":
|
| 575 |
-
import socket
|
| 576 |
-
|
| 577 |
-
def find_free_port(start_port=7860, max_attempts=10):
|
| 578 |
-
"""Find a free port starting from start_port"""
|
| 579 |
-
for port in range(start_port, start_port + max_attempts):
|
| 580 |
-
try:
|
| 581 |
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
| 582 |
-
s.bind(('localhost', port))
|
| 583 |
-
return port
|
| 584 |
-
except OSError:
|
| 585 |
-
continue
|
| 586 |
-
return None
|
| 587 |
-
|
| 588 |
-
# Find an available port
|
| 589 |
-
port = find_free_port()
|
| 590 |
-
if port is None:
|
| 591 |
-
print("❌ Could not find an available port. Please close other applications and try again.")
|
| 592 |
-
exit(1)
|
| 593 |
-
|
| 594 |
-
print(f"🚀 Starting Comprehensive Gradio app on port {port}")
|
| 595 |
-
print(f"📱 Local URL: http://localhost:{port}")
|
| 596 |
-
print(f"🌐 Public URL will be provided once the app starts")
|
| 597 |
-
|
| 598 |
demo.launch(share=True)
|
|
|
|
| 572 |
|
| 573 |
# Launch the app
|
| 574 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 575 |
demo.launch(share=True)
|