kenfoo commited on
Commit
1e17d4d
·
verified ·
1 Parent(s): 989bf63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -50,6 +50,15 @@ def infer(
50
  if randomize_seed:
51
  seed = random.randint(0, MAX_SEED)
52
 
 
 
 
 
 
 
 
 
 
53
  try:
54
  result = space_client.predict(
55
  images=images,
@@ -61,12 +70,14 @@ def infer(
61
  steps=float(steps),
62
  api_name="/infer",
63
  )
 
64
  # result is a tuple: (image_dict, seed)
65
  image_info, seed_used = result
66
  # The API may return image at .url or .path, we use .url if available
67
  img_url = image_info.get("url") or image_info.get("path")
68
  return img_url, seed_used
69
  except Exception as e:
 
70
  return None, seed
71
 
72
  # For examples, use None for image input to avoid Gradio directory/File errors on startup.
 
50
  if randomize_seed:
51
  seed = random.randint(0, MAX_SEED)
52
 
53
+ # Print API call log
54
+ print("[调用API] space_client.predict 输入参数:")
55
+ print(f" images: {images}")
56
+ print(f" prompt: {prompt}")
57
+ print(f" lora_adapter: {lora_adapter}")
58
+ print(f" seed: {seed}")
59
+ print(f" randomize_seed: {randomize_seed}")
60
+ print(f" guidance_scale: {guidance_scale}")
61
+ print(f" steps: {steps}")
62
  try:
63
  result = space_client.predict(
64
  images=images,
 
70
  steps=float(steps),
71
  api_name="/infer",
72
  )
73
+ print(f"[调用API] space_client.predict 返回值: {result}")
74
  # result is a tuple: (image_dict, seed)
75
  image_info, seed_used = result
76
  # The API may return image at .url or .path, we use .url if available
77
  img_url = image_info.get("url") or image_info.get("path")
78
  return img_url, seed_used
79
  except Exception as e:
80
+ print(f"[调用API] 调用接口异常: {e}")
81
  return None, seed
82
 
83
  # For examples, use None for image input to avoid Gradio directory/File errors on startup.