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

Add docstring to infer for MCP compatibility

Browse files

Gradio uses docstring 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 +15 -0
app.py CHANGED
@@ -35,6 +35,21 @@ def infer(
35
  num_inference_steps=8,
36
  progress=gr.Progress(track_tqdm=True),
37
  ):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  if randomize_seed:
39
  seed = random.randint(0, MAX_SEED)
40
 
 
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:
41
+ prompt: The prompt to generate an image from
42
+ negative_prompt: The negative prompt
43
+ seed: The generation seed
44
+ randomize_seed: Whether to randomize the seed
45
+ width: The width of the generated image in pixels
46
+ height: The height of the generated image in pixels
47
+ guidance_scale: How closely the image should align with the prompt
48
+ num_inference_steps: Number of generation steps
49
+
50
+ Returns:
51
+ The generated image and the seed used for generation as a tuple of (PIL.Image.Image, seed)
52
+ """
53
  if randomize_seed:
54
  seed = random.randint(0, MAX_SEED)
55