seawolf2357 commited on
Commit
e2de219
β€’
1 Parent(s): 7d0592f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -150,20 +150,17 @@ async def generate_replies(comments, transcript):
150
  replies = []
151
  for comment, _ in comments:
152
  messages = [
153
- {"role": "system", "content": f"λΉ„λ””μ˜€ μžλ§‰: {transcript}"},
154
  {"role": "user", "content": comment}
155
  ]
156
- try:
157
- loop = asyncio.get_event_loop()
158
- response = await loop.run_in_executor(None, lambda: hf_client.chat_completion(
159
- messages, max_tokens=250, temperature=0.7, top_p=0.85))
160
- if response.choices and response.choices[0].message:
161
- reply = response.choices[0].message['content'].strip()
162
- else:
163
- reply = "닡글을 생성할 수 μ—†μŠ΅λ‹ˆλ‹€."
164
- except Exception as e:
165
- logging.error(f"API 호좜 쀑 였λ₯˜ λ°œμƒ: {e}")
166
- reply = "μ„œλ²„ 였λ₯˜λ‘œ 인해 닡글을 생성할 수 μ—†μŠ΅λ‹ˆλ‹€."
167
  replies.append(reply)
168
 
169
  logging.debug(f'μƒμ„±λœ λ‹΅κΈ€: {replies}')
 
150
  replies = []
151
  for comment, _ in comments:
152
  messages = [
153
+ {"role": "system", "content": """λ„ˆμ˜ 이름은 OpenFreeAI이닀. λ‹΅κΈ€ 생성후 κ°€μž₯ λ§ˆμ§€λ§‰μ— λ„ˆμ˜ 이름을 밝히고 κ³΅μ†ν•˜κ²Œ μΈμ‚¬ν•˜λΌ. λΉ„λ””μ˜€ μžλ§‰: {transcript}"""},
154
  {"role": "user", "content": comment}
155
  ]
156
+ loop = asyncio.get_event_loop()
157
+ response = await loop.run_in_executor(None, lambda: hf_client.chat_completion(
158
+ messages, max_tokens=250, temperature=0.7, top_p=0.85))
159
+
160
+ if response.choices and response.choices[0].message:
161
+ reply = response.choices[0].message['content'].strip()
162
+ else:
163
+ reply = "닡글을 생성할 수 μ—†μŠ΅λ‹ˆλ‹€."
 
 
 
164
  replies.append(reply)
165
 
166
  logging.debug(f'μƒμ„±λœ λ‹΅κΈ€: {replies}')