|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
|
|
|
|
|
echo "π¬ Video Action Recognition App" |
|
|
echo "===============================" |
|
|
echo "Working directory: $SCRIPT_DIR" |
|
|
echo "" |
|
|
|
|
|
|
|
|
cd "$SCRIPT_DIR" |
|
|
|
|
|
|
|
|
if [[ ! -d ".venv" ]]; then |
|
|
echo "β Virtual environment not found" |
|
|
echo "Creating virtual environment..." |
|
|
python3 -m venv .venv |
|
|
if [[ $? -ne 0 ]]; then |
|
|
echo "β Failed to create virtual environment" |
|
|
echo "Please ensure Python 3 is installed" |
|
|
exit 1 |
|
|
fi |
|
|
echo "β
Virtual environment created" |
|
|
fi |
|
|
|
|
|
|
|
|
echo "Activating virtual environment..." |
|
|
source ".venv/bin/activate" |
|
|
|
|
|
if [[ "$VIRTUAL_ENV" == "" ]]; then |
|
|
echo "β Failed to activate virtual environment" |
|
|
echo "Try running manually:" |
|
|
echo " source .venv/bin/activate" |
|
|
echo " streamlit run app.py" |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
echo "β
Virtual environment activated" |
|
|
|
|
|
|
|
|
echo "Checking dependencies..." |
|
|
python -c "import numpy, torch, transformers, streamlit, cv2" 2>/dev/null |
|
|
if [[ $? -ne 0 ]]; then |
|
|
echo "β οΈ Some dependencies missing, installing..." |
|
|
pip install -r requirements.txt |
|
|
if [[ $? -ne 0 ]]; then |
|
|
echo "β Failed to install dependencies" |
|
|
echo "Try running the fix script first: ./run_fix.sh" |
|
|
exit 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
echo "Verifying numpy availability..." |
|
|
python -c " |
|
|
import numpy as np |
|
|
print(f'β
Numpy version: {np.__version__}') |
|
|
|
|
|
# Test the specific operations used in video processing |
|
|
try: |
|
|
test_array = np.array([[[1, 2, 3]]], dtype=np.float32) |
|
|
stacked = np.stack([test_array, test_array], axis=0) |
|
|
print('β
Numpy operations work correctly') |
|
|
except Exception as e: |
|
|
print(f'β Numpy operations failed: {e}') |
|
|
print('Run the fix script: ./run_fix.sh') |
|
|
exit(1) |
|
|
" 2>/dev/null |
|
|
|
|
|
if [[ $? -ne 0 ]]; then |
|
|
echo "β Numpy issues detected" |
|
|
echo "Please run the fix script first:" |
|
|
echo " ./run_fix.sh" |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
echo "" |
|
|
echo "π Starting Streamlit app..." |
|
|
echo "The app will open in your default browser" |
|
|
echo "Press Ctrl+C to stop the server" |
|
|
echo "" |
|
|
|
|
|
|
|
|
streamlit run app.py |
|
|
|
|
|
|
|
|
deactivate |
|
|
|