Update app.py
Browse files
app.py
CHANGED
|
@@ -13,21 +13,30 @@ subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENT
|
|
| 13 |
|
| 14 |
|
| 15 |
def install_apex():
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
try:
|
| 25 |
import apex
|
| 26 |
-
except
|
| 27 |
-
print("
|
| 28 |
install_apex()
|
| 29 |
-
import apex # Try to import again after installation
|
| 30 |
-
|
| 31 |
|
| 32 |
def download_t5_model(model_id, save_directory):
|
| 33 |
# Modelin tokenizer'ını ve modeli indir
|
|
@@ -108,8 +117,10 @@ def main():
|
|
| 108 |
"OpenSora-v1-16x256x256.pth",
|
| 109 |
"OpenSora-v1-HQ-16x256x256.pth",
|
| 110 |
"OpenSora-v1-HQ-16x512x512.pth"
|
| 111 |
-
],
|
| 112 |
-
|
|
|
|
|
|
|
| 113 |
],
|
| 114 |
outputs=gr.Video(label="Output Video"),
|
| 115 |
title="Open-Sora Inference",
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
def install_apex():
|
| 16 |
+
# Apex repository'sini klonla
|
| 17 |
+
subprocess.run(["git", "clone", "https://github.com/NVIDIA/apex"], check=True)
|
| 18 |
+
# Apex dizinine git
|
| 19 |
+
subprocess.run(["cd", "apex"], check=True)
|
| 20 |
+
# Apex'i kur
|
| 21 |
+
try:
|
| 22 |
+
subprocess.run([
|
| 23 |
+
"pip", "install", "-v", "--disable-pip-version-check", "--no-cache-dir",
|
| 24 |
+
"--no-build-isolation", "--config-settings", "--build-option=--cpp_ext",
|
| 25 |
+
"--config-settings", "--build-option=--cuda_ext", "./apex"
|
| 26 |
+
], check=True)
|
| 27 |
+
except subprocess.CalledProcessError:
|
| 28 |
+
# Eğer yukarıdaki komut başarısız olursa, alternatif kurulum komutunu dene
|
| 29 |
+
subprocess.run([
|
| 30 |
+
"pip", "install", "-v", "--disable-pip-version-check", "--no-cache-dir",
|
| 31 |
+
"--no-build-isolation", "--global-option=--cpp_ext", "--global-option=--cuda_ext",
|
| 32 |
+
"./apex"
|
| 33 |
+
], check=True)
|
| 34 |
|
| 35 |
try:
|
| 36 |
import apex
|
| 37 |
+
except ModuleNotFoundError:
|
| 38 |
+
print("Apex not found, installing...")
|
| 39 |
install_apex()
|
|
|
|
|
|
|
| 40 |
|
| 41 |
def download_t5_model(model_id, save_directory):
|
| 42 |
# Modelin tokenizer'ını ve modeli indir
|
|
|
|
| 117 |
"OpenSora-v1-16x256x256.pth",
|
| 118 |
"OpenSora-v1-HQ-16x256x256.pth",
|
| 119 |
"OpenSora-v1-HQ-16x512x512.pth"
|
| 120 |
+
],
|
| 121 |
+
value="OpenSora-v1-16x256x256.pth",
|
| 122 |
+
label="Model Selection"),
|
| 123 |
+
gr.Textbox(label="Prompt Text", value="Enter prompt text here")
|
| 124 |
],
|
| 125 |
outputs=gr.Video(label="Output Video"),
|
| 126 |
title="Open-Sora Inference",
|