stanley-00 commited on
Commit
dda5759
·
1 Parent(s): 5801600

Update default template

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -192,22 +192,17 @@ def update_mode_ui(mode):
192
  show_src = mode == "Translation"
193
  show_tgt = mode == "Translation"
194
 
195
- if mode == "Chat":
196
- prompt_label = "User Message"
197
- prompt_placeholder = "Type your message..."
198
- elif mode == "Q&A":
199
- prompt_label = "Question"
200
- prompt_placeholder = "Enter your question..."
201
- elif mode == "Translation":
202
- prompt_label = "Text to Translate"
203
- prompt_placeholder = "Enter text to translate..."
204
- else:
205
- prompt_label = "Prompt"
206
- prompt_placeholder = "Enter your prompt here..."
207
 
208
  return (
209
  gr.update(visible=show_sys),
210
- gr.update(label=prompt_label, placeholder=prompt_placeholder),
211
  gr.update(visible=show_ctx),
212
  gr.update(visible=show_src),
213
  gr.update(visible=show_tgt),
 
192
  show_src = mode == "Translation"
193
  show_tgt = mode == "Translation"
194
 
195
+ defaults = {
196
+ "Completion": ("Prompt", "Enter your prompt here...", "Once upon a time in a digital kingdom,"),
197
+ "Chat": ("User Message", "Type your message...", "What is the capital of France?"),
198
+ "Q&A": ("Question", "Enter your question...", "How does photosynthesis work?"),
199
+ "Translation": ("Text to Translate", "Enter text to translate...", "Hello, how are you today?"),
200
+ }
201
+ label, placeholder, default = defaults.get(mode, defaults["Completion"])
 
 
 
 
 
202
 
203
  return (
204
  gr.update(visible=show_sys),
205
+ gr.update(label=label, placeholder=placeholder, value=default),
206
  gr.update(visible=show_ctx),
207
  gr.update(visible=show_src),
208
  gr.update(visible=show_tgt),