Spaces:
Runtime error
Runtime error
seawolf2357
commited on
Commit
β’
9941c9f
1
Parent(s):
e1b4bc1
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import discord
|
2 |
import logging
|
3 |
import os
|
@@ -131,13 +132,14 @@ async def generate_reply(comment, transcript):
|
|
131 |
prompt = f"{system_prompt}\nλκΈ: {comment}\nλΉλμ€ μλ§: {transcript}"
|
132 |
response = hf_client.text_generation(prompt)
|
133 |
if response:
|
134 |
-
# JSON νμ± μλ
|
135 |
try:
|
|
|
136 |
response_json = json.loads(response)
|
137 |
return response_json.get("generated_text", "").strip()
|
138 |
except json.JSONDecodeError:
|
|
|
139 |
logging.error(f"Failed to decode JSON: {response}")
|
140 |
-
return response
|
141 |
except Exception as e:
|
142 |
logging.error(f"Error generating reply: {e}")
|
143 |
return "λ΅λ³μ μμ±ν μ μμ΅λλ€."
|
|
|
1 |
+
|
2 |
import discord
|
3 |
import logging
|
4 |
import os
|
|
|
132 |
prompt = f"{system_prompt}\nλκΈ: {comment}\nλΉλμ€ μλ§: {transcript}"
|
133 |
response = hf_client.text_generation(prompt)
|
134 |
if response:
|
|
|
135 |
try:
|
136 |
+
# JSON νμ± μλ
|
137 |
response_json = json.loads(response)
|
138 |
return response_json.get("generated_text", "").strip()
|
139 |
except json.JSONDecodeError:
|
140 |
+
# JSON νμ± μ€ν¨ μ λ‘κ·Έ λ¨κΈ°κ³ μλ΅ κ·Έλλ‘ λ°ν
|
141 |
logging.error(f"Failed to decode JSON: {response}")
|
142 |
+
return response.strip()
|
143 |
except Exception as e:
|
144 |
logging.error(f"Error generating reply: {e}")
|
145 |
return "λ΅λ³μ μμ±ν μ μμ΅λλ€."
|