Update app.py
Browse files
app.py
CHANGED
|
@@ -78,7 +78,7 @@ def get_examples(examples_dir: str = "assets/examples/ghibli-fine-tuned-sd-2.1")
|
|
| 78 |
return ans
|
| 79 |
|
| 80 |
def create_demo(
|
| 81 |
-
model_name: str = "danhtran2mind/
|
| 82 |
device: str = "cuda" if torch.cuda.is_available() else "cpu",
|
| 83 |
):
|
| 84 |
# Convert device string to torch.device
|
|
@@ -179,13 +179,13 @@ def create_demo(
|
|
| 179 |
|
| 180 |
badges_text = r"""
|
| 181 |
<div style="text-align: center; display: flex; justify-content: left; gap: 5px;">
|
| 182 |
-
<a href="https://huggingface.co/spaces/danhtran2mind/
|
| 183 |
</div>
|
| 184 |
""".strip()
|
| 185 |
|
| 186 |
with gr.Blocks() as demo:
|
| 187 |
gr.Markdown("# Ghibli-Style Image Generator")
|
| 188 |
-
gr.
|
| 189 |
gr.Markdown("Generate images in Ghibli style using a fine-tuned Stable Diffusion model. Select an example below to load a pre-generated image or enter a prompt to generate a new one.")
|
| 190 |
gr.Markdown("""**Note:** For CPU inference, execution time is long (e.g., for resolution 512 × 512) with 50 inference steps, time is approximately 1,700 seconds for 1 CPU core and 1,200 seconds for 2 CPUs).""")
|
| 191 |
|
|
@@ -231,7 +231,7 @@ if __name__ == "__main__":
|
|
| 231 |
default=False, metadata={"help": "Use local model path instead of Hugging Face model."}
|
| 232 |
)
|
| 233 |
model_name: str = dataclasses.field(
|
| 234 |
-
default="danhtran2mind/
|
| 235 |
metadata={"help": "Model name or path for the fine-tuned Stable Diffusion model."}
|
| 236 |
)
|
| 237 |
device: str = dataclasses.field(
|
|
@@ -251,7 +251,7 @@ if __name__ == "__main__":
|
|
| 251 |
|
| 252 |
# Set model_name based on local_model flag
|
| 253 |
if args.local_model:
|
| 254 |
-
args.model_name = "
|
| 255 |
|
| 256 |
demo = create_demo(args.model_name, args.device)
|
| 257 |
demo.launch(server_port=args.port, share=args.share)
|
|
|
|
| 78 |
return ans
|
| 79 |
|
| 80 |
def create_demo(
|
| 81 |
+
model_name: str = "danhtran2mind/Ghibli-Stable-Diffusion-2.1-Base-finetuning",
|
| 82 |
device: str = "cuda" if torch.cuda.is_available() else "cpu",
|
| 83 |
):
|
| 84 |
# Convert device string to torch.device
|
|
|
|
| 179 |
|
| 180 |
badges_text = r"""
|
| 181 |
<div style="text-align: center; display: flex; justify-content: left; gap: 5px;">
|
| 182 |
+
<a href="https://huggingface.co/spaces/danhtran2mind/Ghibli-Stable-Diffusion-Synthesis"><img src="https://img.shields.io/static/v1?label=%F0%9F%A4%97%20Hugging%20Face&message=Space&color=orange"></a>
|
| 183 |
</div>
|
| 184 |
""".strip()
|
| 185 |
|
| 186 |
with gr.Blocks() as demo:
|
| 187 |
gr.Markdown("# Ghibli-Style Image Generator")
|
| 188 |
+
gr.HTML(badges_text)
|
| 189 |
gr.Markdown("Generate images in Ghibli style using a fine-tuned Stable Diffusion model. Select an example below to load a pre-generated image or enter a prompt to generate a new one.")
|
| 190 |
gr.Markdown("""**Note:** For CPU inference, execution time is long (e.g., for resolution 512 × 512) with 50 inference steps, time is approximately 1,700 seconds for 1 CPU core and 1,200 seconds for 2 CPUs).""")
|
| 191 |
|
|
|
|
| 231 |
default=False, metadata={"help": "Use local model path instead of Hugging Face model."}
|
| 232 |
)
|
| 233 |
model_name: str = dataclasses.field(
|
| 234 |
+
default="danhtran2mind/Ghibli-Stable-Diffusion-2.1-Base-finetuning",
|
| 235 |
metadata={"help": "Model name or path for the fine-tuned Stable Diffusion model."}
|
| 236 |
)
|
| 237 |
device: str = dataclasses.field(
|
|
|
|
| 251 |
|
| 252 |
# Set model_name based on local_model flag
|
| 253 |
if args.local_model:
|
| 254 |
+
args.model_name = "Ghibli-Stable-Diffusion-2.1-Base-finetuning"
|
| 255 |
|
| 256 |
demo = create_demo(args.model_name, args.device)
|
| 257 |
demo.launch(server_port=args.port, share=args.share)
|