ginipick commited on
Commit
2d978fc
β€’
1 Parent(s): fd636b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -30,6 +30,7 @@ def load_parquet(filename: str) -> str:
30
  except Exception as e:
31
  return f"νŒŒμΌμ„ μ½λŠ” 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: {str(e)}"
32
 
 
33
  def respond(
34
  message: str,
35
  history: List[Dict[str, str]],
@@ -53,7 +54,7 @@ def respond(
53
  else:
54
  system_prefix = system_message or "λ„ˆλŠ” AI μ‘°μ–Έμž 역할이닀."
55
 
56
- # λ©”μ‹œμ§€ 생성 (API μš”κ΅¬ 사항에 맞게 μˆ˜μ •)
57
  prompt = system_prefix + "\n\n"
58
  for chat in history:
59
  if chat['role'] == 'user':
@@ -73,9 +74,8 @@ def respond(
73
  top_p=top_p,
74
  )
75
  for msg in stream:
76
- token = msg.get('generated_text', '')
77
- if token:
78
- response += token
79
  yield response
80
  except Exception as e:
81
  error_message = f"μΆ”λ‘  쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: {str(e)}\n{traceback.format_exc()}"
 
30
  except Exception as e:
31
  return f"νŒŒμΌμ„ μ½λŠ” 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: {str(e)}"
32
 
33
+
34
  def respond(
35
  message: str,
36
  history: List[Dict[str, str]],
 
54
  else:
55
  system_prefix = system_message or "λ„ˆλŠ” AI μ‘°μ–Έμž 역할이닀."
56
 
57
+ # λ©”μ‹œμ§€ 생성
58
  prompt = system_prefix + "\n\n"
59
  for chat in history:
60
  if chat['role'] == 'user':
 
74
  top_p=top_p,
75
  )
76
  for msg in stream:
77
+ if msg:
78
+ response += msg
 
79
  yield response
80
  except Exception as e:
81
  error_message = f"μΆ”λ‘  쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: {str(e)}\n{traceback.format_exc()}"