Nekochu commited on
Commit
b7cce06
·
1 Parent(s): f75cb69

add MCP server, REST API, docstring, gradio[mcp], ~30 min timing

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. app.py +15 -3
Dockerfile CHANGED
@@ -52,7 +52,7 @@ RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/ae.safetensors \
52
  "https://huggingface.co/SeeSee21/Z-Anime/resolve/main/vae/ae.safetensors"
53
 
54
  # Install Python deps
55
- RUN pip3 install --no-cache-dir gradio Pillow
56
 
57
  COPY app.py /app/app.py
58
 
 
52
  "https://huggingface.co/SeeSee21/Z-Anime/resolve/main/vae/ae.safetensors"
53
 
54
  # Install Python deps
55
+ RUN pip3 install --no-cache-dir "gradio[mcp]" Pillow
56
 
57
  COPY app.py /app/app.py
58
 
app.py CHANGED
@@ -37,6 +37,17 @@ _proc_lock = threading.Lock()
37
  # ---------------------------------------------------------------------------
38
 
39
  def generate(prompt, negative_prompt, resolution, seed):
 
 
 
 
 
 
 
 
 
 
 
40
  global _active_proc
41
 
42
  if not prompt or not prompt.strip():
@@ -128,7 +139,7 @@ with gr.Blocks(title="Z-Anime (CPU)") as demo:
128
  gr.Markdown(
129
  "**[Z-Anime 6B](https://huggingface.co/SeeSee21/Z-Anime)** S3-DiT Q5_0 GGUF "
130
  "(distill 4-step) via [sd.cpp](https://github.com/leejet/stable-diffusion.cpp) | "
131
- "~42 min at 512x512 on free CPU"
132
  )
133
  with gr.Row():
134
  with gr.Column():
@@ -148,7 +159,8 @@ with gr.Blocks(title="Z-Anime (CPU)") as demo:
148
  gen_btn.click(fn=generate,
149
  inputs=[prompt_input, neg_input, res_input, seed_input],
150
  outputs=[output_img, status_box],
151
- concurrency_limit=1)
 
152
 
153
  def _on_unload():
154
  with _proc_lock:
@@ -159,4 +171,4 @@ with gr.Blocks(title="Z-Anime (CPU)") as demo:
159
 
160
  demo.unload(_on_unload)
161
 
162
- demo.launch(server_name="0.0.0.0", server_port=7860, show_error=True, theme="NoCrypt/miku")
 
37
  # ---------------------------------------------------------------------------
38
 
39
  def generate(prompt, negative_prompt, resolution, seed):
40
+ """Generate an anime image using Z-Anime 6B model.
41
+
42
+ Args:
43
+ prompt: Text description of the image to generate.
44
+ negative_prompt: Things to avoid in the generated image.
45
+ resolution: Image resolution (512x512, 768x512, or 512x768).
46
+ seed: Random seed (-1 for random).
47
+
48
+ Returns:
49
+ tuple: Generated image and status message.
50
+ """
51
  global _active_proc
52
 
53
  if not prompt or not prompt.strip():
 
139
  gr.Markdown(
140
  "**[Z-Anime 6B](https://huggingface.co/SeeSee21/Z-Anime)** S3-DiT Q5_0 GGUF "
141
  "(distill 4-step) via [sd.cpp](https://github.com/leejet/stable-diffusion.cpp) | "
142
+ "~30 min at 512x512 on free CPU"
143
  )
144
  with gr.Row():
145
  with gr.Column():
 
159
  gen_btn.click(fn=generate,
160
  inputs=[prompt_input, neg_input, res_input, seed_input],
161
  outputs=[output_img, status_box],
162
+ concurrency_limit=1,
163
+ api_name="generate")
164
 
165
  def _on_unload():
166
  with _proc_lock:
 
171
 
172
  demo.unload(_on_unload)
173
 
174
+ demo.launch(server_name="0.0.0.0", server_port=7860, show_error=True, theme="NoCrypt/miku", mcp_server=True)