Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -44,20 +44,28 @@ def run_inference(prompt, stable_diffusion_model, num_inference_steps, guidance_
|
|
44 |
|
45 |
|
46 |
# Define Gradio UI components
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
inputs=[
|
62 |
prompt,
|
63 |
stable_diffusion_model,
|
@@ -70,10 +78,14 @@ gr.Interface(
|
|
70 |
verbose
|
71 |
],
|
72 |
outputs=[
|
73 |
-
|
74 |
-
|
75 |
],
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
|
46 |
# Define Gradio UI components
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
def demo_UI():
|
51 |
+
prompt = gr.Textbox(label="Your Prompt", info="What the Minecraft Skin should look like")
|
52 |
+
stable_diffusion_model = gr.Dropdown(['2', 'xl'], value="xl", label="Stable Diffusion Model", info="Choose which Stable Diffusion Model to use, xl understands prompts better")
|
53 |
+
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 is more precise but more resource consuming")
|
54 |
+
|
55 |
+
with gr.Row():
|
56 |
+
num_inference_steps = gr.Slider(label="Number of 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", minimum=1, maximum=50, value=25, step=1)
|
57 |
+
guidance_scale = gr.Slider(label="Guidance Scale", info="Controls how much the image generation process follows the text prompt. Higher values make the image stick more closely to the input text.", minimum=0.0, maximum=10.0, value=7.5, step=0.1)
|
58 |
+
seed = gr.Slider(value=42, minimum=0, maximum=MAX_SEED, step=1, label="Seed", info="A starting point to initiate the generation process, put 0 for a random one")
|
59 |
+
|
60 |
+
|
61 |
+
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")
|
62 |
+
with gr.Row():
|
63 |
+
model_3d = gr.Checkbox(label="See as 3D Model too", info="View the generated skin as a 3D Model too", value=True)
|
64 |
+
verbose = gr.Checkbox(label="Verbose Output", info="Produce more detailed output while running", value=False)
|
65 |
+
generate_skn = gr.Button("Generate")
|
66 |
+
image_output = gr.Image(label="Generated Minecraft Skin Image Asset", elem_classes="pixelated checkered"),
|
67 |
+
image3d_output = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model View of the Skin")
|
68 |
+
generate_skn.click(fn=run_inference,
|
69 |
inputs=[
|
70 |
prompt,
|
71 |
stable_diffusion_model,
|
|
|
78 |
verbose
|
79 |
],
|
80 |
outputs=[
|
81 |
+
image_output,
|
82 |
+
image3d_output,
|
83 |
],
|
84 |
+
)
|
85 |
+
|
86 |
+
with gr.Blocks(title="Minecraft Skin Generator", css=".pixelated {image-rendering: pixelated} .checkered img {background-image: url(\'data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"2\" height=\"2\" fill-opacity=\".15\"><rect x=\"1\" width=\"1\" height=\"1\"/><rect y=\"1\" width=\"1\" height=\"1\"/></svg>\');background-size: 16px;}") as imsteve:
|
87 |
+
gr.Label("Minecraft Skin Generator")
|
88 |
+
gr.Markdown("Make AI generated Minecraft Skins by a Finetuned Stable Diffusion Version!<br>Github Repository & Model used: https://github.com/Nick088Official/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), [not-holar](https://huggingface.co/not-holar) (made the rendering of the image asset in the web ui look pixelated like minecraft and have a checkered background),[meew](https://huggingface.co/spaces/meeww/Minecraft_Skin_Generator/blob/main/models/player_model.glb) (Minecraft Player 3d model) <br> [](https://discord.gg/AQsmBmgEPy)")
|
89 |
+
demo_UI()
|
90 |
+
|
91 |
+
imsteve.launch(show_api=False, share=True)
|