Spaces:
Runtime error
Runtime error
Boghdady9 commited on
Commit Β·
d6145e3
1
Parent(s): 50bda14
π§ Add debugging and error handling for Gradio startup
Browse files- Enhanced start_app.sh with detailed logging and process tracking
- Added comprehensive error handling to gradio_app.py launch
- Include file listing and directory checks for troubleshooting
- Added timing delays between backend and frontend startup
- Better error reporting with full tracebacks for debugging
- src/gradio_app.py +23 -7
- src/start_app.sh +23 -1
src/gradio_app.py
CHANGED
|
@@ -475,10 +475,26 @@ def create_medivision_app():
|
|
| 475 |
|
| 476 |
# Create and launch the app
|
| 477 |
if __name__ == "__main__":
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
|
| 476 |
# Create and launch the app
|
| 477 |
if __name__ == "__main__":
|
| 478 |
+
print("π Initializing MediVision Gradio App...")
|
| 479 |
+
try:
|
| 480 |
+
print("π Creating Gradio interface...")
|
| 481 |
+
app = create_medivision_app()
|
| 482 |
+
print("β
Gradio interface created successfully!")
|
| 483 |
+
|
| 484 |
+
print("π Launching Gradio app...")
|
| 485 |
+
print(f"π Server: 0.0.0.0:7860")
|
| 486 |
+
print(f"π Share: True")
|
| 487 |
+
|
| 488 |
+
app.launch(
|
| 489 |
+
server_name="0.0.0.0",
|
| 490 |
+
server_port=7860,
|
| 491 |
+
share=True,
|
| 492 |
+
show_api=False
|
| 493 |
+
)
|
| 494 |
+
|
| 495 |
+
except Exception as e:
|
| 496 |
+
print(f"β Error launching Gradio app: {str(e)}")
|
| 497 |
+
import traceback
|
| 498 |
+
print(f"π Full traceback:")
|
| 499 |
+
traceback.print_exc()
|
| 500 |
+
raise
|
src/start_app.sh
CHANGED
|
@@ -1,19 +1,41 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
|
|
|
|
|
|
| 3 |
echo "π¬ MediVision - AI-Powered Radiology Report System"
|
| 4 |
echo "=================================================="
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# Check if argument provided
|
| 7 |
if [ "$1" = "streamlit" ]; then
|
| 8 |
echo "π Starting with Streamlit..."
|
| 9 |
cd /app/backend && uvicorn service:app --host 0.0.0.0 --port 8001 &
|
|
|
|
|
|
|
|
|
|
| 10 |
cd /app && streamlit run streamlit_app.py --server.port 8501 --server.address 0.0.0.0 --server.enableXsrfProtection=false
|
| 11 |
elif [ "$1" = "gradio" ]; then
|
| 12 |
echo "π Starting with Gradio..."
|
| 13 |
cd /app/backend && uvicorn service:app --host 0.0.0.0 --port 8001 &
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
cd /app && python gradio_app.py
|
| 15 |
else
|
| 16 |
echo "π Starting with Gradio (default)..."
|
| 17 |
cd /app/backend && uvicorn service:app --host 0.0.0.0 --port 8001 &
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
fi
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
+
echo "===== Application Startup at $(date) ====="
|
| 4 |
+
echo ""
|
| 5 |
echo "π¬ MediVision - AI-Powered Radiology Report System"
|
| 6 |
echo "=================================================="
|
| 7 |
|
| 8 |
+
# Check current directory and list files
|
| 9 |
+
echo "π Current directory: $(pwd)"
|
| 10 |
+
echo "π Available files:"
|
| 11 |
+
ls -la /app/
|
| 12 |
+
|
| 13 |
# Check if argument provided
|
| 14 |
if [ "$1" = "streamlit" ]; then
|
| 15 |
echo "π Starting with Streamlit..."
|
| 16 |
cd /app/backend && uvicorn service:app --host 0.0.0.0 --port 8001 &
|
| 17 |
+
BACKEND_PID=$!
|
| 18 |
+
echo "π§ Backend started with PID: $BACKEND_PID"
|
| 19 |
+
sleep 2
|
| 20 |
cd /app && streamlit run streamlit_app.py --server.port 8501 --server.address 0.0.0.0 --server.enableXsrfProtection=false
|
| 21 |
elif [ "$1" = "gradio" ]; then
|
| 22 |
echo "π Starting with Gradio..."
|
| 23 |
cd /app/backend && uvicorn service:app --host 0.0.0.0 --port 8001 &
|
| 24 |
+
BACKEND_PID=$!
|
| 25 |
+
echo "π§ Backend started with PID: $BACKEND_PID"
|
| 26 |
+
sleep 3
|
| 27 |
+
echo "π Starting Gradio frontend..."
|
| 28 |
cd /app && python gradio_app.py
|
| 29 |
else
|
| 30 |
echo "π Starting with Gradio (default)..."
|
| 31 |
cd /app/backend && uvicorn service:app --host 0.0.0.0 --port 8001 &
|
| 32 |
+
BACKEND_PID=$!
|
| 33 |
+
echo "π§ Backend started with PID: $BACKEND_PID"
|
| 34 |
+
sleep 3
|
| 35 |
+
echo "π Starting Gradio frontend..."
|
| 36 |
+
cd /app
|
| 37 |
+
echo "π About to run: python gradio_app.py"
|
| 38 |
+
echo "π Files in current directory:"
|
| 39 |
+
ls -la
|
| 40 |
+
python gradio_app.py
|
| 41 |
fi
|