Nick088 commited on
Commit
c43cd70
Β·
verified Β·
1 Parent(s): ff917af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -8
app.py CHANGED
@@ -53,13 +53,13 @@ num_inference_steps = gr.Number(label="Number of Inference Steps", precision=0,
53
  guidance_scale = gr.Number(minimum=0.1, value=7.5, label="Guidance Scale", 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")
54
  model_precision_type = gr.Dropdown(["fp16", "fp32"], value="fp16", label="Model Precision Type", info="The precision type to load the model, like fp16 which is faster, or fp32 which gives better results")
55
  seed = gr.Number(value=42, label="Seed", info="A starting point to initiate generation, put 0 for a random one")
56
- filename = gr.Textbox(label="Output Image Name", info="The name of the file of the output image skin, keep the.png", value="output-skin.png")
57
  verbose = gr.Checkbox(label="Verbose Output", info="Produce more detailed output while running", value=False)
58
- see_in_3d = gr.Checkbox(label="See in 3D", info="View the generated skin in 3D", value=False)
59
 
60
 
61
  # Create the Gradio interface
62
- gr.Interface(
63
  fn=run_inference,
64
  inputs=[
65
  prompt,
@@ -68,14 +68,24 @@ gr.Interface(
68
  guidance_scale,
69
  model_precision_type,
70
  seed,
71
- filename,
72
  verbose,
73
  see_in_3d
74
  ],
75
  outputs=[
76
- gr.Image(label="Generated Minecraft Skin Image Asset"),
77
- gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model")
78
  ],
79
  title="Minecraft Skin Generator",
80
- 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>Credits: [Monadical-SAS](https://github.com/Monadical-SAS/minecraft_skin_generator) (Creators of the model), [Nick088](https://linktr.ee/Nick088) (Improving usage of the model), daroche (helping me fix the 3d model texture isue), [Brottweiler](https://gist.github.com/Brottweiler/483d0856c6692ef70cf90bf1a85ce364)(script to fix the 3d model texture, [meew](https://huggingface.co/spaces/meeww/Minecraft_Skin_Generator/blob/main/models/player_model.glb) (Minecraft Player 3d model)",
81
- ).launch(show_api=False, share=True)
 
 
 
 
 
 
 
 
 
 
 
 
53
  guidance_scale = gr.Number(minimum=0.1, value=7.5, label="Guidance Scale", 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")
54
  model_precision_type = gr.Dropdown(["fp16", "fp32"], value="fp16", label="Model Precision Type", info="The precision type to load the model, like fp16 which is faster, or fp32 which gives better results")
55
  seed = gr.Number(value=42, label="Seed", info="A starting point to initiate generation, put 0 for a random one")
56
+ filename = gr.Textbox(label="Output Image Name", info="The name of the file of the output image skin, keep the .png", value="output-skin.png")
57
  verbose = gr.Checkbox(label="Verbose Output", info="Produce more detailed output while running", value=False)
58
+ see_in_3d = gr.Checkbox(label="See in 3D", info="View the generated skin in 3D", value=True)
59
 
60
 
61
  # Create the Gradio interface
62
+ interface = gr.Interface(
63
  fn=run_inference,
64
  inputs=[
65
  prompt,
 
68
  guidance_scale,
69
  model_precision_type,
70
  seed,
71
+ filename,
72
  verbose,
73
  see_in_3d
74
  ],
75
  outputs=[
76
+ gr.Image(label="Generated Minecraft Skin Image Asset")
 
77
  ],
78
  title="Minecraft Skin Generator",
79
+ 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>Credits: [Monadical-SAS](https://github.com/Monadical-SAS/minecraft_skin_generator) (Creators of the model), [Nick088](https://linktr.ee/Nick088) (Improving usage of the model), daroche (helping me fix the 3d model texture isue), [Brottweiler](https://gist.github.com/Brottweiler/483d0856c6692ef70cf90bf1a85ce364)(script to fix the 3d model texture, [meew](https://huggingface.co/spaces/meeww/Minecraft_Skin_Generator/blob/main/models/player_model.glb) (Minecraft Player 3d model)"
80
+ )
81
+
82
+ # Add a custom output component that displays the 3D model if the "See in 3D" input is True
83
+ def custom_output(image_path, glb_path):
84
+ if glb_path is None:
85
+ return image_path
86
+ else:
87
+ return [image_path, gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model", path=glb_path)]
88
+
89
+ interface.add_output(custom_output, inputs=[interface.output[0], interface.input[8]])
90
+
91
+ interface.launch(show_api=False, share=True)