Spaces:
Runtime error
Runtime error
folder renaming
Browse files- Dockerfile +1 -1
- README.md +3 -3
- app.py → app-img2img.py +6 -2
- {public → img2img}/index.html +0 -0
- public/tailwind.config.js → tailwind.config.js +0 -0
Dockerfile
CHANGED
@@ -36,4 +36,4 @@ WORKDIR $HOME/app
|
|
36 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
37 |
COPY --chown=user . $HOME/app
|
38 |
|
39 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
36 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
37 |
COPY --chown=user . $HOME/app
|
38 |
|
39 |
+
CMD ["uvicorn", "app-img2img:app", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
CHANGED
@@ -24,18 +24,18 @@ You need CUDA and Python
|
|
24 |
python -m venv venv
|
25 |
source venv/bin/activate
|
26 |
pip install -r requirements.txt
|
27 |
-
uvicorn "app:app" --host 0.0.0.0 --port 7860 --reload
|
28 |
```
|
29 |
or with environment variables
|
30 |
```bash
|
31 |
-
TIMEOUT=120 SAFETY_CHECKER=True MAX_QUEUE_SIZE=4 uvicorn "app:app" --host 0.0.0.0 --port 7860 --reload
|
32 |
```
|
33 |
|
34 |
If you're running locally and want to test it on Mobile Safari, the webserver needs to be served over HTTPS.
|
35 |
|
36 |
```bash
|
37 |
openssl req -newkey rsa:4096 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
|
38 |
-
uvicorn "app:app" --host 0.0.0.0 --port 7860 --reload --log-level info --ssl-certfile=certificate.pem --ssl-keyfile=key.pem
|
39 |
```
|
40 |
## Docker
|
41 |
You need NVIDIA Container Toolkit for Docker
|
|
|
24 |
python -m venv venv
|
25 |
source venv/bin/activate
|
26 |
pip install -r requirements.txt
|
27 |
+
uvicorn "app-img2img:app" --host 0.0.0.0 --port 7860 --reload
|
28 |
```
|
29 |
or with environment variables
|
30 |
```bash
|
31 |
+
TIMEOUT=120 SAFETY_CHECKER=True MAX_QUEUE_SIZE=4 uvicorn "app-img2img:app" --host 0.0.0.0 --port 7860 --reload
|
32 |
```
|
33 |
|
34 |
If you're running locally and want to test it on Mobile Safari, the webserver needs to be served over HTTPS.
|
35 |
|
36 |
```bash
|
37 |
openssl req -newkey rsa:4096 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
|
38 |
+
uvicorn "app-img2img:app" --host 0.0.0.0 --port 7860 --reload --log-level info --ssl-certfile=certificate.pem --ssl-keyfile=key.pem
|
39 |
```
|
40 |
## Docker
|
41 |
You need NVIDIA Container Toolkit for Docker
|
app.py → app-img2img.py
RENAMED
@@ -32,6 +32,7 @@ if SAFETY_CHECKER == "True":
|
|
32 |
"SimianLuo/LCM_Dreamshaper_v7",
|
33 |
custom_pipeline="latent_consistency_img2img.py",
|
34 |
custom_revision="main",
|
|
|
35 |
)
|
36 |
else:
|
37 |
pipe = DiffusionPipeline.from_pretrained(
|
@@ -39,17 +40,20 @@ else:
|
|
39 |
safety_checker=None,
|
40 |
custom_pipeline="latent_consistency_img2img.py",
|
41 |
custom_revision="main",
|
|
|
42 |
)
|
43 |
#TODO try to use tiny VAE
|
44 |
# pipe.vae = AutoencoderTiny.from_pretrained(
|
45 |
# "madebyollin/taesd", torch_dtype=torch.float16, use_safetensors=True
|
46 |
# )
|
47 |
pipe.set_progress_bar_config(disable=True)
|
48 |
-
pipe.to(torch_device="cuda", torch_dtype=torch.
|
49 |
pipe.unet.to(memory_format=torch.channels_last)
|
50 |
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
51 |
user_queue_map = {}
|
52 |
|
|
|
|
|
53 |
|
54 |
def predict(input_image, prompt, guidance_scale=8.0, strength=0.5, seed=2159232):
|
55 |
generator = torch.manual_seed(seed)
|
@@ -210,4 +214,4 @@ async def handle_websocket_data(websocket: WebSocket, user_id: uuid.UUID):
|
|
210 |
traceback.print_exc()
|
211 |
|
212 |
|
213 |
-
app.mount("/", StaticFiles(directory="
|
|
|
32 |
"SimianLuo/LCM_Dreamshaper_v7",
|
33 |
custom_pipeline="latent_consistency_img2img.py",
|
34 |
custom_revision="main",
|
35 |
+
torch_dtype=torch.float32
|
36 |
)
|
37 |
else:
|
38 |
pipe = DiffusionPipeline.from_pretrained(
|
|
|
40 |
safety_checker=None,
|
41 |
custom_pipeline="latent_consistency_img2img.py",
|
42 |
custom_revision="main",
|
43 |
+
torch_dtype=torch.float32
|
44 |
)
|
45 |
#TODO try to use tiny VAE
|
46 |
# pipe.vae = AutoencoderTiny.from_pretrained(
|
47 |
# "madebyollin/taesd", torch_dtype=torch.float16, use_safetensors=True
|
48 |
# )
|
49 |
pipe.set_progress_bar_config(disable=True)
|
50 |
+
pipe.to(torch_device="cuda", torch_dtype=torch.float32)
|
51 |
pipe.unet.to(memory_format=torch.channels_last)
|
52 |
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
53 |
user_queue_map = {}
|
54 |
|
55 |
+
# for torch.compile
|
56 |
+
pipe(prompt="warmup", image=[Image.new("RGB", (512, 512))])
|
57 |
|
58 |
def predict(input_image, prompt, guidance_scale=8.0, strength=0.5, seed=2159232):
|
59 |
generator = torch.manual_seed(seed)
|
|
|
214 |
traceback.print_exc()
|
215 |
|
216 |
|
217 |
+
app.mount("/", StaticFiles(directory="img2img", html=True), name="public")
|
{public → img2img}/index.html
RENAMED
File without changes
|
public/tailwind.config.js → tailwind.config.js
RENAMED
File without changes
|