Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -170,14 +170,14 @@ def vote_down_model(state, chatbot, chatbot2):
|
|
| 170 |
async def user_ask(state, chatbot1, chatbot2, textbox, character_name, character_description, user_name):
|
| 171 |
if character_name and len(character_name) > 20:
|
| 172 |
character_name = character_name[:20] # Limit character name to 20 characters
|
| 173 |
-
if character_description and len(character_description) >
|
| 174 |
-
character_description = character_description[:
|
| 175 |
if user_name and len(user_name) > 20:
|
| 176 |
user_name = user_name[:20] # Limit user name to 20 characters
|
| 177 |
global enable_btn
|
| 178 |
user_input = textbox
|
| 179 |
-
if len(user_input) >
|
| 180 |
-
user_input = user_input[:
|
| 181 |
|
| 182 |
collection = init_database() # Initialize the collection object
|
| 183 |
# Keep only the last 10 messages in history
|
|
@@ -274,14 +274,14 @@ with gr.Blocks() as demo:
|
|
| 274 |
|
| 275 |
with gr.Row():
|
| 276 |
with gr.Column(scale=5):
|
| 277 |
-
textbox = gr.Textbox(placeholder="🎤 Enter your prompt (up to
|
| 278 |
submit_btn = gr.Button(value="Submit")
|
| 279 |
|
| 280 |
with gr.Row():
|
| 281 |
reset_btn = gr.Button(value="🗑️ Reset")
|
| 282 |
with gr.Row():
|
| 283 |
character_name = gr.Textbox(label="Character Name", value="Ryan", placeholder="Enter character name (max 20 chars)")
|
| 284 |
-
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
|
| 285 |
|
| 286 |
with gr.Row():
|
| 287 |
user_name = gr.Textbox(label="Your Name", value="You", placeholder="Enter your name (max 20 chars)")
|
|
|
|
| 170 |
async def user_ask(state, chatbot1, chatbot2, textbox, character_name, character_description, user_name):
|
| 171 |
if character_name and len(character_name) > 20:
|
| 172 |
character_name = character_name[:20] # Limit character name to 20 characters
|
| 173 |
+
if character_description and len(character_description) > 500:
|
| 174 |
+
character_description = character_description[:500] # Limit character description to 200 characters
|
| 175 |
if user_name and len(user_name) > 20:
|
| 176 |
user_name = user_name[:20] # Limit user name to 20 characters
|
| 177 |
global enable_btn
|
| 178 |
user_input = textbox
|
| 179 |
+
if len(user_input) > 500:
|
| 180 |
+
user_input = user_input[:500] # Limit user input to 200 characters
|
| 181 |
|
| 182 |
collection = init_database() # Initialize the collection object
|
| 183 |
# Keep only the last 10 messages in history
|
|
|
|
| 274 |
|
| 275 |
with gr.Row():
|
| 276 |
with gr.Column(scale=5):
|
| 277 |
+
textbox = gr.Textbox(placeholder="🎤 Enter your prompt (up to 500 characters)")
|
| 278 |
submit_btn = gr.Button(value="Submit")
|
| 279 |
|
| 280 |
with gr.Row():
|
| 281 |
reset_btn = gr.Button(value="🗑️ Reset")
|
| 282 |
with gr.Row():
|
| 283 |
character_name = gr.Textbox(label="Character Name", value="Ryan", placeholder="Enter character name (max 20 chars)")
|
| 284 |
+
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 500 chars)")
|
| 285 |
|
| 286 |
with gr.Row():
|
| 287 |
user_name = gr.Textbox(label="Your Name", value="You", placeholder="Enter your name (max 20 chars)")
|