ginipick commited on
Commit
4042beb
ยท
verified ยท
1 Parent(s): a71c5b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -177,16 +177,16 @@ def analyze_space(url: str, progress=gr.Progress()):
177
  print(traceback.format_exc())
178
  return f"์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}", "", None, "", "", "", "", 10
179
 
180
-
181
  def format_chat_history(chat_history):
182
  formatted = []
183
- for message in chat_history:
184
- if message["role"] in ["user", "assistant"]:
185
- formatted.append(message)
 
 
186
  return formatted
187
 
188
-
189
- def respond_stream(message: str, chat_history: List[Dict[str, str]], max_tokens: int, temperature: float, top_p: float):
190
  system_message = """๋‹น์‹ ์€ ํ—ˆ๊น…ํŽ˜์ด์Šค์— ํŠนํ™”๋œ AI ์ฝ”๋”ฉ ์ „๋ฌธ๊ฐ€์ž…๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž์˜ ์งˆ๋ฌธ์— ์นœ์ ˆํ•˜๊ณ  ์ƒ์„ธํ•˜๊ฒŒ ๋‹ต๋ณ€ํ•ด์ฃผ์„ธ์š”.
191
  Gradio ํŠน์„ฑ์„ ์ •ํ™•ํžˆ ์ธ์‹ํ•˜๊ณ  Requirements.txt ๋ˆ„๋ฝ์—†์ด ์ฝ”๋”ฉ๊ณผ ์˜ค๋ฅ˜๋ฅผ ํ•ด๊ฒฐํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
192
  ํ•ญ์ƒ ์ •ํ™•ํ•˜๊ณ  ์œ ์šฉํ•œ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋„๋ก ๋…ธ๋ ฅํ•˜์„ธ์š”."""
@@ -349,9 +349,10 @@ def create_ui():
349
 
350
  msg.submit(respond_wrapper, [msg, chatbot, max_tokens, temperature, top_p], [msg, chatbot])
351
 
352
-
353
 
354
 
 
 
355
 
356
  space_id_state = gr.State()
357
  tree_structure_state = gr.State()
 
177
  print(traceback.format_exc())
178
  return f"์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}", "", None, "", "", "", "", 10
179
 
 
180
  def format_chat_history(chat_history):
181
  formatted = []
182
+ for user_message, assistant_message in chat_history:
183
+ if user_message:
184
+ formatted.append({"role": "user", "content": user_message})
185
+ if assistant_message:
186
+ formatted.append({"role": "assistant", "content": assistant_message})
187
  return formatted
188
 
189
+ def respond_stream(message: str, chat_history: List[Tuple[str, str]], max_tokens: int, temperature: float, top_p: float):
 
190
  system_message = """๋‹น์‹ ์€ ํ—ˆ๊น…ํŽ˜์ด์Šค์— ํŠนํ™”๋œ AI ์ฝ”๋”ฉ ์ „๋ฌธ๊ฐ€์ž…๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž์˜ ์งˆ๋ฌธ์— ์นœ์ ˆํ•˜๊ณ  ์ƒ์„ธํ•˜๊ฒŒ ๋‹ต๋ณ€ํ•ด์ฃผ์„ธ์š”.
191
  Gradio ํŠน์„ฑ์„ ์ •ํ™•ํžˆ ์ธ์‹ํ•˜๊ณ  Requirements.txt ๋ˆ„๋ฝ์—†์ด ์ฝ”๋”ฉ๊ณผ ์˜ค๋ฅ˜๋ฅผ ํ•ด๊ฒฐํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
192
  ํ•ญ์ƒ ์ •ํ™•ํ•˜๊ณ  ์œ ์šฉํ•œ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋„๋ก ๋…ธ๋ ฅํ•˜์„ธ์š”."""
 
349
 
350
  msg.submit(respond_wrapper, [msg, chatbot, max_tokens, temperature, top_p], [msg, chatbot])
351
 
 
352
 
353
 
354
+
355
+
356
 
357
  space_id_state = gr.State()
358
  tree_structure_state = gr.State()