salomonsky commited on
Commit
af78765
·
verified ·
1 Parent(s): 10337dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -11,13 +11,14 @@ def format_prompt(message, history):
11
  global system_prompt_sent
12
  prompt = "<s>"
13
 
14
- if not any(f"[INST] {system_prompt} [/INST]" in user_prompt for user_prompt, _ in history):
15
- prompt += f"[INST] {system_prompt} [/INST]"
16
- system_prompt_sent = True
 
17
 
18
- for user_prompt, bot_response in history:
19
- prompt += f"[INST] {user_prompt} [/INST]"
20
- prompt += f" {bot_response}</s> "
21
 
22
  prompt += f"[INST] {message} [/INST]"
23
  return prompt
@@ -69,7 +70,7 @@ chat_interface = gr.Interface(
69
  inputs=[input_text],
70
  outputs=[output_audio, output_text],
71
  live=True,
72
- theme="soft",
73
  )
74
 
75
  chat_interface.launch(share=True, debug=True)
 
11
  global system_prompt_sent
12
  prompt = "<s>"
13
 
14
+ if history is not None and isinstance(history, list):
15
+ if not any(f"[INST] {system_prompt} [/INST]" in user_prompt for user_prompt, _ in history):
16
+ prompt += f"[INST] {system_prompt} [/INST]"
17
+ system_prompt_sent = True
18
 
19
+ for user_prompt, bot_response in history:
20
+ prompt += f"[INST] {user_prompt} [/INST]"
21
+ prompt += f" {bot_response}</s> "
22
 
23
  prompt += f"[INST] {message} [/INST]"
24
  return prompt
 
70
  inputs=[input_text],
71
  outputs=[output_audio, output_text],
72
  live=True,
73
+ theme="compact",
74
  )
75
 
76
  chat_interface.launch(share=True, debug=True)