Spaces:
Running
on
Zero
Running
on
Zero
Update app.py (#3)
Browse files- Update app.py (cede6a84554808efb11346a22ea8abb8be0a9b8a)
Co-authored-by: 1inkus <[email protected]>
app.py
CHANGED
|
@@ -16,6 +16,7 @@ alloc_conf_parts = [
|
|
| 16 |
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = ','.join(alloc_conf_parts)
|
| 17 |
os.environ["SAFETENSORS_FAST_GPU"] = "1"
|
| 18 |
os.putenv('HF_HUB_ENABLE_HF_TRANSFER','1')
|
|
|
|
| 19 |
|
| 20 |
import random
|
| 21 |
import uuid
|
|
@@ -103,6 +104,12 @@ ip_ckpt = os.path.join(local_folder2, "ip-adapter_sdxl_vit-h.bin") # Correct pat
|
|
| 103 |
|
| 104 |
upscaler = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(torch.device("cuda:0"))
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
|
| 107 |
if style_name in styles:
|
| 108 |
p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
|
|
|
|
| 16 |
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = ','.join(alloc_conf_parts)
|
| 17 |
os.environ["SAFETENSORS_FAST_GPU"] = "1"
|
| 18 |
os.putenv('HF_HUB_ENABLE_HF_TRANSFER','1')
|
| 19 |
+
import subprocess
|
| 20 |
|
| 21 |
import random
|
| 22 |
import uuid
|
|
|
|
| 104 |
|
| 105 |
upscaler = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(torch.device("cuda:0"))
|
| 106 |
|
| 107 |
+
@spaces.GPU(required=True)
|
| 108 |
+
def install_flashattn():
|
| 109 |
+
subprocess.run(['sh', './flashattn.sh'])
|
| 110 |
+
|
| 111 |
+
install_flashattn()
|
| 112 |
+
|
| 113 |
def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
|
| 114 |
if style_name in styles:
|
| 115 |
p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
|