Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,10 +24,17 @@ def respond(message):
|
|
24 |
num_inference_steps=28,
|
25 |
api_name="/infer_t2i"
|
26 |
)
|
27 |
-
logging.info("
|
28 |
|
29 |
-
# 결과
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
except Exception as e:
|
32 |
logging.error("Error during API request: %s", str(e))
|
33 |
return "Failed to generate image due to an error."
|
|
|
24 |
num_inference_steps=28,
|
25 |
api_name="/infer_t2i"
|
26 |
)
|
27 |
+
logging.info("API response received: %s", result)
|
28 |
|
29 |
+
# 결과 확인 및 처리
|
30 |
+
if isinstance(result, dict) and 'url' in result:
|
31 |
+
return result['url']
|
32 |
+
elif isinstance(result, tuple):
|
33 |
+
logging.error("Unexpected tuple response: %s", result)
|
34 |
+
# 튜플 응답 처리, 예를 들어 result[0] 이 url을 포함하고 있다고 가정
|
35 |
+
return result[0]
|
36 |
+
else:
|
37 |
+
raise ValueError("Unexpected API response format")
|
38 |
except Exception as e:
|
39 |
logging.error("Error during API request: %s", str(e))
|
40 |
return "Failed to generate image due to an error."
|