chansung commited on
Commit
7700f9c
1 Parent(s): 1d804c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -12,6 +12,30 @@ chl_file = open("channels.txt", "r")
12
  channels = chl_file.read().split("\n")
13
  channel_btns = []
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  with gr.Blocks(css=MODEL_SELECTION_CSS, theme='gradio/soft') as demo:
16
  with gr.Column(visible=False) as chat_view:
17
  idx = gr.State(0)
 
12
  channels = chl_file.read().split("\n")
13
  channel_btns = []
14
 
15
+ def fill_up_placeholders(txt):
16
+ placeholders = get_placeholders(txt)
17
+ highlighted_txt = txt
18
+
19
+ return (
20
+ gr.update(
21
+ visible=True,
22
+ value=highlighted_txt
23
+ ),
24
+ gr.update(
25
+ visible=True if len(placeholders) >= 1 else False,
26
+ placeholder=placeholders[0] if len(placeholders) >= 1 else ""
27
+ ),
28
+ gr.update(
29
+ visible=True if len(placeholders) >= 2 else False,
30
+ placeholder=placeholders[1] if len(placeholders) >= 2 else ""
31
+ ),
32
+ gr.update(
33
+ visible=True if len(placeholders) >= 3 else False,
34
+ placeholder=placeholders[2] if len(placeholders) >= 3 else ""
35
+ ),
36
+ "" if len(placeholders) >= 1 else txt
37
+ )
38
+
39
  with gr.Blocks(css=MODEL_SELECTION_CSS, theme='gradio/soft') as demo:
40
  with gr.Column(visible=False) as chat_view:
41
  idx = gr.State(0)