Commit
·
6fc6fef
1
Parent(s):
2158a12
```text
Browse filesRefactor app.py to fix issue with zero-gpu spaces
The app.py file was refactored to address an issue with zero-gpu spaces not working as expected. The issue was discussed in more detail [here](https://huggingface.co/spaces/zero-gpu-explorers/README/discussions/106#66e278a396acd45223e0d00b). Additionally, the pip package was upgraded to the latest version.
app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
# Testing one file gradio app for zero gpu spaces not working as expected.
|
| 2 |
-
# Check here for the issue:
|
|
|
|
|
|
|
| 3 |
import gc
|
| 4 |
import json
|
| 5 |
import random
|
|
@@ -49,6 +51,9 @@ from sd_embed.embedding_funcs import get_weighted_text_embeddings_sdxl, get_weig
|
|
| 49 |
|
| 50 |
|
| 51 |
# Initialize System
|
|
|
|
|
|
|
|
|
|
| 52 |
def load_sd():
|
| 53 |
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 54 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 1 |
# Testing one file gradio app for zero gpu spaces not working as expected.
|
| 2 |
+
# Check here for the issue: https://huggingface.co/spaces/zero-gpu-explorers/README/discussions/106#66e278a396acd45223e0d00b
|
| 3 |
+
|
| 4 |
+
import os
|
| 5 |
import gc
|
| 6 |
import json
|
| 7 |
import random
|
|
|
|
| 51 |
|
| 52 |
|
| 53 |
# Initialize System
|
| 54 |
+
os.system("pip install --upgrade pip")
|
| 55 |
+
|
| 56 |
+
|
| 57 |
def load_sd():
|
| 58 |
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 59 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|