Transcendental-Programmer
commited on
Commit
Β·
112b759
1
Parent(s):
afb8be0
Add Dockerfile for Hugging Face Spaces and update README with deployment instructions
Browse files- Dockerfile +20 -0
- README.md +53 -34
Dockerfile
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10-slim
|
2 |
+
|
3 |
+
# Install system dependencies
|
4 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
5 |
+
|
6 |
+
# Set workdir
|
7 |
+
WORKDIR /app
|
8 |
+
|
9 |
+
# Copy requirements and install
|
10 |
+
COPY requirements.txt ./
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
# Copy all code
|
14 |
+
COPY . .
|
15 |
+
|
16 |
+
# Expose Gradio port
|
17 |
+
EXPOSE 7860
|
18 |
+
|
19 |
+
# Run Gradio app
|
20 |
+
CMD ["python", "faceforge_ui/app.py"]
|
README.md
CHANGED
@@ -1,37 +1,56 @@
|
|
1 |
# faceforge
|
2 |
Interactive latent space editor for face generation using pretrained GANs and diffusion models.
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# faceforge
|
2 |
Interactive latent space editor for face generation using pretrained GANs and diffusion models.
|
3 |
|
4 |
+
## π Deploy on Hugging Face Spaces (Recommended)
|
5 |
+
|
6 |
+
FaceForge is ready to run as a Gradio app on [Hugging Face Spaces](https://huggingface.co/spaces):
|
7 |
+
|
8 |
+
1. **Push your code to a public GitHub repository.**
|
9 |
+
2. **Create a new Space** at https://huggingface.co/spaces (choose the Gradio SDK or Docker SDK).
|
10 |
+
3. **Add your `requirements.txt` and the provided `Dockerfile` to your repo.**
|
11 |
+
4. **Set the entrypoint to `faceforge_ui/app.py`** (the Gradio app).
|
12 |
+
5. **Deploy!** Your app will be live at `https://<your-username>.hf.space`.
|
13 |
+
|
14 |
+
### Example Dockerfile (already included):
|
15 |
+
```Dockerfile
|
16 |
+
FROM python:3.10-slim
|
17 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
18 |
+
WORKDIR /app
|
19 |
+
COPY requirements.txt ./
|
20 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
21 |
+
COPY . .
|
22 |
+
EXPOSE 7860
|
23 |
+
CMD ["python", "faceforge_ui/app.py"]
|
24 |
+
```
|
25 |
+
|
26 |
+
## Local Development (Optional)
|
27 |
+
|
28 |
+
You can still run FaceForge locally:
|
29 |
+
|
30 |
+
```bash
|
31 |
+
pip install -r requirements.txt
|
32 |
+
python faceforge_ui/app.py
|
33 |
+
```
|
34 |
+
|
35 |
+
## Features
|
36 |
+
- Latent space exploration and manipulation
|
37 |
+
- Attribute direction discovery (PCA/classifier)
|
38 |
+
- Custom attribute-preserving loss
|
39 |
+
- Modular, testable core
|
40 |
+
- Gradio UI for interactive exploration
|
41 |
+
|
42 |
+
## Controls (Gradio UI)
|
43 |
+
- Enter prompts (comma-separated)
|
44 |
+
- Choose sampling mode (distance/circle)
|
45 |
+
- Adjust player position sliders
|
46 |
+
- Click "Generate" to see results
|
47 |
+
|
48 |
+
## Testing
|
49 |
+
Run all tests with:
|
50 |
+
```bash
|
51 |
+
pytest tests/
|
52 |
+
```
|
53 |
+
|
54 |
+
## Notes
|
55 |
+
- The backend and frontend are fully integrated for Spaces.
|
56 |
+
- For custom model integration, edit the core and backend modules as needed.
|