xarical commited on
Commit
9750634
·
1 Parent(s): 2e58901

Add type hints to infer for MCP compatibility

Browse files

Gradio uses type hints to generate MCP schema (at /gradio_api/mcp/schema) that MCP clients use to get tool desc and arg type and desc

Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -25,16 +25,16 @@ MAX_IMAGE_SIZE = 1024
25
 
26
  @spaces.GPU(duration=65)
27
  def infer(
28
- prompt,
29
- negative_prompt="",
30
- seed=42,
31
- randomize_seed=False,
32
- width=1024,
33
- height=1024,
34
- guidance_scale=1.5,
35
- num_inference_steps=8,
36
- progress=gr.Progress(track_tqdm=True),
37
- ):
38
  """Generate an image using Stable Diffusion 3.5 Large TurboX.
39
 
40
  Args:
 
25
 
26
  @spaces.GPU(duration=65)
27
  def infer(
28
+ prompt: str,
29
+ negative_prompt: str = "",
30
+ seed: int = 42,
31
+ randomize_seed: bool = False,
32
+ width: int = 1024,
33
+ height: int = 1024,
34
+ guidance_scale: float = 1.5,
35
+ num_inference_steps: int = 8,
36
+ progress: gr.Progress = gr.Progress(track_tqdm=True),
37
+ ) -> tuple["PIL.Image.Image", int]:
38
  """Generate an image using Stable Diffusion 3.5 Large TurboX.
39
 
40
  Args: