Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,28 +31,21 @@ def respond(
|
|
31 |
messages.append({"role": "assistant", "content": assistant_msg})
|
32 |
messages.append({"role": "user", "content": message})
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
logging.error("์ด๋ฏธ์ง ์์ฑ ์คํจ: %s", result.get('error', '์ ์ ์๋ ์ค๋ฅ'))
|
50 |
-
return "์ด๋ฏธ์ง ์์ฑ์ ์คํจํ์ต๋๋ค."
|
51 |
-
except Exception as e:
|
52 |
-
logging.error("API ์์ฒญ ์ค ์ค๋ฅ ๋ฐ์: %s", str(e))
|
53 |
-
return f"์ค๋ฅ ๋ฐ์: {str(e)}"
|
54 |
-
finally:
|
55 |
-
logging.info("์์ฒญ ์ฒ๋ฆฌ ์๋ฃ")
|
56 |
|
57 |
theme = "Nymbo/Nymbo_Theme"
|
58 |
css = """
|
|
|
31 |
messages.append({"role": "assistant", "content": assistant_msg})
|
32 |
messages.append({"role": "user", "content": message})
|
33 |
|
34 |
+
try:
|
35 |
+
result = client.predict(...)
|
36 |
+
if isinstance(result, dict) and 'url' in result:
|
37 |
+
return result['url']
|
38 |
+
else:
|
39 |
+
logging.error("๊ฒฐ๊ณผ ์ฒ๋ฆฌ ์คํจ: ๊ฒฐ๊ณผ๊ฐ ๋์
๋๋ฆฌ ํํ๊ฐ ์๋")
|
40 |
+
return "์ด๋ฏธ์ง ์์ฑ์ ์คํจํ์ต๋๋ค."
|
41 |
+
except AttributeError as e:
|
42 |
+
logging.error("์์ฑ ์ค๋ฅ: %s", str(e))
|
43 |
+
return "๋ด๋ถ ์ฒ๋ฆฌ ์ค๋ฅ ๋ฐ์"
|
44 |
+
except Exception as e:
|
45 |
+
logging.error("API ์์ฒญ ์ค ์ค๋ฅ ๋ฐ์: %s", str(e))
|
46 |
+
return f"์ค๋ฅ ๋ฐ์: {str(e)}"
|
47 |
+
finally:
|
48 |
+
logging.info("์์ฒญ ์ฒ๋ฆฌ ์๋ฃ")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
theme = "Nymbo/Nymbo_Theme"
|
51 |
css = """
|