Nick088 commited on
Commit
5e2f771
Β·
verified Β·
1 Parent(s): 39edf71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -17,6 +17,7 @@ os.chdir("Stable_Diffusion_Finetuned_Minecraft_Skin_Generator")
17
 
18
  def generate(
19
  prompt,
 
20
  num_inference_steps,
21
  guidance_scale,
22
  num_images_per_prompt,
@@ -30,13 +31,19 @@ def generate(
30
  else:
31
  verbose_opt = ''
32
 
33
- subprocess.run(["python", "Python_Script/minecraft-skins-sdxl.py", prompt, num_inference_steps, guidance_scale, num_images_per_prompt, model_precision_type, seed, output_image_name, verbose_opt])
 
 
 
 
 
34
 
35
  return os.path.join(f"output_minecraft_skins/{output_image_name}")
36
 
37
 
38
  prompt = gr.Textbox(label="Prompt", interactive=True)
39
 
 
40
 
41
  num_inference_steps = gr.Number(value=50, minimum=1, interactive=True, label="Inference Steps", info="The number of denoising steps of the image. More denoising steps usually lead to a higher quality image at the cost of slower inference")
42
 
@@ -55,6 +62,7 @@ verbose = gr.Checkbox(label="Verbose Output", interactive=True, value=False, inf
55
  examples = [
56
  [
57
  "A man in a purple suit wearing a tophat.",
 
58
  25,
59
  7.5,
60
  1,
@@ -67,7 +75,7 @@ examples = [
67
 
68
  gr.Interface(
69
  fn=generate,
70
- inputs=[prompt, num_inference_steps, guidance_scale, num_images_per_prompt, model_precision_type, output_image_name, seed, verbose],
71
  outputs=gr.Image(label="Generated Minecraft Skin"),
72
  title="Stable Diffusion Finetuned Minecraft Skin Generator",
73
  description="Make AI generated Minecraft Skins by a Finetuned Stable Diffusion Version!<br>Model used: https://github.com/Nick088Official/Stable_Diffusion_Finetuned_Minecraft_Skin_Generator<br>Hugging Face Space made by [Nick088](https://linktr.ee/Nick088)",
 
17
 
18
  def generate(
19
  prompt,
20
+ stable_diffusion_model,
21
  num_inference_steps,
22
  guidance_scale,
23
  num_images_per_prompt,
 
31
  else:
32
  verbose_opt = ''
33
 
34
+ if stable_diffusion_model == 'xl':
35
+ sd_model = "minecraft-skins-sdxl"
36
+ else:
37
+ sd_model = "minecraft-skins"
38
+
39
+ subprocess.run(["python", f"Python_Script/{sd_model}.py", prompt, num_inference_steps, guidance_scale, num_images_per_prompt, model_precision_type, seed, output_image_name, verbose_opt])
40
 
41
  return os.path.join(f"output_minecraft_skins/{output_image_name}")
42
 
43
 
44
  prompt = gr.Textbox(label="Prompt", interactive=True)
45
 
46
+ stable_diffusion_model = gr.Dropdown(["2", "xl"], interactive=True, label="Stable Diffusion Model", value="xl", info="Choose which Stable Diffusion Model to use, xl understands prompts better")
47
 
48
  num_inference_steps = gr.Number(value=50, minimum=1, interactive=True, label="Inference Steps", info="The number of denoising steps of the image. More denoising steps usually lead to a higher quality image at the cost of slower inference")
49
 
 
62
  examples = [
63
  [
64
  "A man in a purple suit wearing a tophat.",
65
+ "xl",
66
  25,
67
  7.5,
68
  1,
 
75
 
76
  gr.Interface(
77
  fn=generate,
78
+ inputs=[prompt, stable_diffusion_model, num_inference_steps, guidance_scale, num_images_per_prompt, model_precision_type, output_image_name, seed, verbose],
79
  outputs=gr.Image(label="Generated Minecraft Skin"),
80
  title="Stable Diffusion Finetuned Minecraft Skin Generator",
81
  description="Make AI generated Minecraft Skins by a Finetuned Stable Diffusion Version!<br>Model used: https://github.com/Nick088Official/Stable_Diffusion_Finetuned_Minecraft_Skin_Generator<br>Hugging Face Space made by [Nick088](https://linktr.ee/Nick088)",