pratyushmaini commited on
Commit
9b59d5d
·
1 Parent(s): a98205d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -206,15 +206,21 @@ with gr.Blocks(css=css) as demo:
206
  # Create a new history with emojis added
207
  history_with_emojis = []
208
  for user_msg, assistant_msg in history:
209
- # Add the user emoji to the user message
210
  if user_msg:
211
- user_msg_with_emoji = f"👤 {user_msg}"
 
 
 
212
  else:
213
  user_msg_with_emoji = user_msg
214
 
215
- # Add the assistant emoji to the assistant message
216
  if assistant_msg:
217
- assistant_msg_with_emoji = f"🛡️ {assistant_msg}"
 
 
 
218
  else:
219
  assistant_msg_with_emoji = assistant_msg
220
 
 
206
  # Create a new history with emojis added
207
  history_with_emojis = []
208
  for user_msg, assistant_msg in history:
209
+ # Add the user emoji to the user message (only if it doesn't already have one)
210
  if user_msg:
211
+ if not user_msg.startswith("👤 "):
212
+ user_msg_with_emoji = f"👤 {user_msg}"
213
+ else:
214
+ user_msg_with_emoji = user_msg
215
  else:
216
  user_msg_with_emoji = user_msg
217
 
218
+ # Add the assistant emoji to the assistant message (only if it doesn't already have one)
219
  if assistant_msg:
220
+ if not assistant_msg.startswith("🛡️ "):
221
+ assistant_msg_with_emoji = f"🛡️ {assistant_msg}"
222
+ else:
223
+ assistant_msg_with_emoji = assistant_msg
224
  else:
225
  assistant_msg_with_emoji = assistant_msg
226