OppaAI commited on
Commit
d13c8a5
·
verified ·
1 Parent(s): 112b4db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -6,13 +6,13 @@ import json
6
 
7
  def process(json_input):
8
  try:
9
- data = json_input
 
10
 
11
- # Base64 → PIL Image
12
  img_bytes = base64.b64decode(data["image_b64"])
13
  img = Image.open(io.BytesIO(img_bytes))
14
 
15
- return img # <-- 直接顯示圖片
16
 
17
  except Exception as e:
18
  return None
 
6
 
7
  def process(json_input):
8
  try:
9
+ # json_input from gr.JSON() is STRING, so must parse
10
+ data = json.loads(json_input)
11
 
 
12
  img_bytes = base64.b64decode(data["image_b64"])
13
  img = Image.open(io.BytesIO(img_bytes))
14
 
15
+ return img # show image
16
 
17
  except Exception as e:
18
  return None