ll7098ll commited on
Commit
c13a256
·
verified ·
1 Parent(s): 226be95

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -14
app.py CHANGED
@@ -29,21 +29,8 @@ model = genai.GenerativeModel(
29
  chat_session = model.start_chat(history=[])
30
 
31
  def respond(user_input, history):
32
- history.append((user_input, "")) # 빈 답변 추가
33
- chatbot.append((user_input, "")) # 채팅창에 빈 답변 추가
34
-
35
  response = chat_session.send_message(user_input)
36
-
37
- # 응답을 실시간으로 타이핑 효과 구현
38
- for i in range(len(response.text)):
39
- history[0] = (user_input, response.text[:i+1]) # 답변 부분만 업데이트
40
- chatbot.append(history[-1]) # 채팅창 업데이트
41
- yield "", history # 업데이트된 채팅창 반환
42
- time.sleep(0.5) # 타이핑 속도 조절
43
-
44
- history.append((user_input, response.text)) # 완전한 답변 추가
45
- chatbot.append(history[0]) # 채팅창 업데이트
46
-
47
  return "", history
48
 
49
  with gr.Blocks() as demo:
 
29
  chat_session = model.start_chat(history=[])
30
 
31
  def respond(user_input, history):
 
 
 
32
  response = chat_session.send_message(user_input)
33
+ history.append((user_input, response.text))
 
 
 
 
 
 
 
 
 
 
34
  return "", history
35
 
36
  with gr.Blocks() as demo: