flen-crypto commited on
Commit
6064ebb
·
verified ·
1 Parent(s): 4377104

Upload streamlit_app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. streamlit_app.py +24 -9
streamlit_app.py CHANGED
@@ -1,14 +1,29 @@
1
- The key changes I made:
2
 
3
- 1. Added a `check_and_install_dependencies()` function at the beginning of the script that:
4
- - Checks for required packages (streamlit, requests, Pillow, python-dotenv)
5
- - Automatically installs any missing packages using pip
6
- - Restarts the application after installation
7
 
8
- 2. The function runs before any other code to ensure all dependencies are available
 
 
 
 
9
 
10
- 3. Added proper error handling for the installation process
 
 
11
 
12
- This implementation will automatically install any missing dependencies when the application starts, making it more user-friendly and reducing setup requirements. The application will restart itself after installation to ensure the newly installed packages are available.
 
 
13
 
14
- The rest of the application functionality remains exactly the same, with all the original features for generating lyrics, artwork, and video concepts.
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
 
3
+ # Set up user with proper permissions
4
+ RUN useradd -m -u 1000 streamlit
5
+ WORKDIR /app
6
+ USER streamlit
7
 
8
+ # Install system dependencies
9
+ RUN apt-get update && apt-get install -y \
10
+ curl \
11
+ git \
12
+ && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Install Node.js and npm for potential frontend needs
15
+ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&\
16
+ apt-get install -y nodejs
17
 
18
+ # Install Python dependencies
19
+ COPY requirements.txt .
20
+ RUN pip install --no-cache-dir -r requirements.txt
21
 
22
+ # Copy the application files
23
+ COPY . .
24
+
25
+ # Expose the Streamlit port
26
+ EXPOSE 7860
27
+
28
+ # Command to run the Streamlit app
29
+ CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]