rwitz commited on
Commit
1ae0dc3
·
verified ·
1 Parent(s): de1d1bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -121,7 +121,7 @@ async def get_bot_response(adapter_id, prompt, state, bot_index, character_name,
121
  except (aiohttp.ClientError, asyncio.TimeoutError):
122
  response_text = "Sorry, I couldn't generate a response."
123
  return response_text.strip()
124
- async def chat_with_bots(user_input, state):
125
  # Use existing bot order from state if available, otherwise shuffle and initialize
126
  if 'last_bots' not in state or not state['last_bots']:
127
  random.shuffle(chatbots)
@@ -160,7 +160,7 @@ def vote_down_model(state, chatbot, chatbot2):
160
  chatbot.append(update_message[1])
161
  return chatbot, chatbot2, gr.Button.update(interactive=False), gr.Button.update(interactive=False), gr.Textbox.update(interactive=False), gr.Button.update(interactive=False)
162
 
163
- async def user_ask(state, chatbot1, chatbot2, textbox):
164
  global enable_btn
165
  user_input = textbox
166
  if len(user_input) > 200:
@@ -266,8 +266,8 @@ with gr.Blocks() as demo:
266
  with gr.Row():
267
  reset_btn = gr.Button(value="🗑️ Reset")
268
  with gr.Row():
269
- character_name = gr.Textbox(value="Ryan", placeholder="Enter character name (max 20 chars)", max_lines=1)
270
- character_description = gr.Textbox(value="Ryan is a college student who is always willing to help. He knows a lot about math and coding.", placeholder="Enter character description (max 200 chars)", max_lines=5)
271
 
272
 
273
  # ...
 
121
  except (aiohttp.ClientError, asyncio.TimeoutError):
122
  response_text = "Sorry, I couldn't generate a response."
123
  return response_text.strip()
124
+ async def chat_with_bots(user_input, state, character_name, character_description):
125
  # Use existing bot order from state if available, otherwise shuffle and initialize
126
  if 'last_bots' not in state or not state['last_bots']:
127
  random.shuffle(chatbots)
 
160
  chatbot.append(update_message[1])
161
  return chatbot, chatbot2, gr.Button.update(interactive=False), gr.Button.update(interactive=False), gr.Textbox.update(interactive=False), gr.Button.update(interactive=False)
162
 
163
+ async def user_ask(state, chatbot1, chatbot2, textbox, character_name, character_description):
164
  global enable_btn
165
  user_input = textbox
166
  if len(user_input) > 200:
 
266
  with gr.Row():
267
  reset_btn = gr.Button(value="🗑️ Reset")
268
  with gr.Row():
269
+ character_name = gr.Textbox(label="Character Name",value="Ryan", placeholder="Enter character name (max 20 chars)", max_lines=1)
270
+ character_description = gr.Textbox(label="Character Description",value="Ryan is a college student who is always willing to help. He knows a lot about math and coding.", placeholder="Enter character description (max 200 chars)", max_lines=5)
271
 
272
 
273
  # ...