Rooni commited on
Commit
703ae82
·
verified ·
1 Parent(s): fc4ed9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -60,7 +60,15 @@ def generate_image(prompt, structure_image, style_image, depth_strength=15, styl
60
  style_strength=style_strength,
61
  api_name="/generate_image"
62
  )
63
- return result['url']
 
 
 
 
 
 
 
 
64
 
65
  # Примеры для Gradio
66
  examples = [
 
60
  style_strength=style_strength,
61
  api_name="/generate_image"
62
  )
63
+
64
+ if isinstance(result, str) and os.path.exists(result):
65
+ output_image = Image.open(result)
66
+ elif isinstance(result, bytes):
67
+ output_image = Image.open(BytesIO(result))
68
+ else:
69
+ raise ValueError(f"Неожиданный тип результата API: {type(result)}")
70
+
71
+ return output_image
72
 
73
  # Примеры для Gradio
74
  examples = [