Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,16 +4,20 @@ import gradio as gr
|
|
| 4 |
import torch
|
| 5 |
import numpy as np
|
| 6 |
from PIL import Image, ImageEnhance
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Constants
|
| 10 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 11 |
MAX_SEED = np.iinfo(np.int32).max
|
| 12 |
OUTPUT_DIR = "output_minecraft_skins"
|
| 13 |
|
| 14 |
-
print(f"Using {DEVICE}")
|
| 15 |
|
| 16 |
-
#
|
| 17 |
REPO_URL = "https://github.com/Nick088Official/Minecraft_Skin_Generator.git"
|
| 18 |
REPO_NAME = "Minecraft_Skin_Generator"
|
| 19 |
|
|
@@ -31,8 +35,8 @@ else:
|
|
| 31 |
# Change to the repository directory for script execution
|
| 32 |
os.chdir(REPO_NAME)
|
| 33 |
|
| 34 |
-
|
| 35 |
-
@spaces.GPU(duration=75)
|
| 36 |
def run_inference(
|
| 37 |
prompt: str,
|
| 38 |
stable_diffusion_model: str,
|
|
@@ -152,5 +156,3 @@ def create_gradio_ui():
|
|
| 152 |
if __name__ == "__main__":
|
| 153 |
demo = create_gradio_ui()
|
| 154 |
demo.launch(show_api=False, share=True)
|
| 155 |
-
|
| 156 |
-
|
|
|
|
| 4 |
import torch
|
| 5 |
import numpy as np
|
| 6 |
from PIL import Image, ImageEnhance
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
if os.environ.get("HF_TOKEN") or os.environ.get("HF_HOME") or os.environ.get("HUGGINGFACE_HUB_CACHE"):
|
| 10 |
+
import spaces
|
| 11 |
+
|
| 12 |
|
| 13 |
# Constants
|
| 14 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 15 |
MAX_SEED = np.iinfo(np.int32).max
|
| 16 |
OUTPUT_DIR = "output_minecraft_skins"
|
| 17 |
|
| 18 |
+
print(f"Using: {DEVICE}")
|
| 19 |
|
| 20 |
+
# Repo URL
|
| 21 |
REPO_URL = "https://github.com/Nick088Official/Minecraft_Skin_Generator.git"
|
| 22 |
REPO_NAME = "Minecraft_Skin_Generator"
|
| 23 |
|
|
|
|
| 35 |
# Change to the repository directory for script execution
|
| 36 |
os.chdir(REPO_NAME)
|
| 37 |
|
| 38 |
+
if os.environ.get("HF_TOKEN") or os.environ.get("HF_HOME") or os.environ.get("HUGGINGFACE_HUB_CACHE"):
|
| 39 |
+
@spaces.GPU(duration=75)
|
| 40 |
def run_inference(
|
| 41 |
prompt: str,
|
| 42 |
stable_diffusion_model: str,
|
|
|
|
| 156 |
if __name__ == "__main__":
|
| 157 |
demo = create_gradio_ui()
|
| 158 |
demo.launch(show_api=False, share=True)
|
|
|
|
|
|