Longxiang-ai commited on
Commit
7a2a3df
·
1 Parent(s): 746a46d

Use Docker with Python 3.10 for compatibility

Browse files
Files changed (4) hide show
  1. Dockerfile +37 -0
  2. README.md +1 -3
  3. app.py +1 -1
  4. requirements.txt +1 -4
Dockerfile ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.10 to avoid compatibility issues
2
+ FROM python:3.10-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ git \
10
+ ffmpeg \
11
+ libsm6 \
12
+ libxext6 \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Copy requirements first for caching
16
+ COPY requirements.txt .
17
+
18
+ # Install Python dependencies
19
+ RUN pip install --no-cache-dir -r requirements.txt
20
+
21
+ # Copy application code
22
+ COPY . .
23
+
24
+ # Create user for HuggingFace Spaces
25
+ RUN useradd -m -u 1000 user
26
+ USER user
27
+
28
+ # Set environment variables
29
+ ENV HOME=/home/user \
30
+ PATH=/home/user/.local/bin:$PATH \
31
+ PYTHONUNBUFFERED=1
32
+
33
+ # Expose port
34
+ EXPOSE 7860
35
+
36
+ # Run the application
37
+ CMD ["python", "app.py"]
README.md CHANGED
@@ -3,9 +3,7 @@ title: TransNormal
3
  emoji: 🔮
4
  colorFrom: blue
5
  colorTo: purple
6
- sdk: gradio
7
- sdk_version: 5.9.1
8
- app_file: app.py
9
  pinned: false
10
  license: cc-by-nc-4.0
11
  suggested_hardware: zero-a10g
 
3
  emoji: 🔮
4
  colorFrom: blue
5
  colorTo: purple
6
+ sdk: docker
 
 
7
  pinned: false
8
  license: cc-by-nc-4.0
9
  suggested_hardware: zero-a10g
app.py CHANGED
@@ -193,4 +193,4 @@ with gr.Blocks(
193
 
194
  # Launch
195
  if __name__ == "__main__":
196
- demo.launch()
 
193
 
194
  # Launch
195
  if __name__ == "__main__":
196
+ demo.launch(server_name="0.0.0.0", server_port=7860)
requirements.txt CHANGED
@@ -18,8 +18,5 @@ numpy>=1.23.0
18
  huggingface_hub
19
 
20
  # Gradio and Spaces
21
- gradio>=5.0.0
22
  spaces
23
-
24
- # Python 3.13 compatibility (audioop was removed in 3.13)
25
- audioop-lts; python_version>="3.13"
 
18
  huggingface_hub
19
 
20
  # Gradio and Spaces
21
+ gradio==4.44.0
22
  spaces