Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,15 +13,9 @@ hf_client = InferenceClient("CohereForAI/c4ai-command-r-plus", token=os.getenv("
|
|
13 |
client = Client("http://211.233.58.202:7960/")
|
14 |
|
15 |
|
16 |
-
def respond(
|
17 |
-
|
18 |
-
|
19 |
-
system_message,
|
20 |
-
max_tokens,
|
21 |
-
temperature,
|
22 |
-
top_p,
|
23 |
-
):
|
24 |
-
system_prefix = "System: ์
๋ ฅ์ด์ ์ธ์ด(์์ด, ํ๊ตญ์ด, ์ค๊ตญ์ด, ์ผ๋ณธ์ด ๋ฑ)์ ๋ฐ๋ผ ๋์ผํ ์ธ์ด๋ก ๋ต๋ณํ๋ผ."
|
25 |
full_system_message = f"{system_prefix}{system_message}"
|
26 |
|
27 |
messages = [{"role": "system", "content": f"{system_prefix} {system_message}"}]
|
@@ -31,21 +25,19 @@ 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 |
-
except
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
finally:
|
48 |
-
logging.info("์์ฒญ ์ฒ๋ฆฌ ์๋ฃ")
|
49 |
|
50 |
theme = "Nymbo/Nymbo_Theme"
|
51 |
css = """
|
|
|
13 |
client = Client("http://211.233.58.202:7960/")
|
14 |
|
15 |
|
16 |
+
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
17 |
+
# ์ด๊ธฐ ์ค์ ๋ฐ ๋ณ์ ์ ์
|
18 |
+
system_prefix = "System: ์
๋ ฅ์ด์ ์ธ์ด์ ๋ฐ๋ผ ๋์ผํ ์ธ์ด๋ก ๋ต๋ณํ๋ผ."
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
full_system_message = f"{system_prefix}{system_message}"
|
20 |
|
21 |
messages = [{"role": "system", "content": f"{system_prefix} {system_message}"}]
|
|
|
25 |
messages.append({"role": "assistant", "content": assistant_msg})
|
26 |
messages.append({"role": "user", "content": message})
|
27 |
|
28 |
+
# ์ด๋ฏธ์ง ์์ฑ ์์ฒญ
|
29 |
+
try:
|
30 |
+
result = client.predict(...)
|
31 |
+
if 'url' in result:
|
32 |
+
return result['url']
|
33 |
+
else:
|
34 |
+
return "์ด๋ฏธ์ง ์์ฑ์ ์คํจํ์ต๋๋ค."
|
35 |
+
except Exception as e:
|
36 |
+
return f"์ค๋ฅ ๋ฐ์: {str(e)}"
|
37 |
+
finally:
|
38 |
+
# ํ์ํ ๊ฒฝ์ฐ ๋ฆฌ์์ค ์ ๋ฆฌ
|
39 |
+
pass
|
40 |
+
|
|
|
|
|
41 |
|
42 |
theme = "Nymbo/Nymbo_Theme"
|
43 |
css = """
|