chansung commited on
Commit
ae17679
1 Parent(s): f05b198

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
  import json
3
  import copy
4
  import gradio as gr
@@ -30,6 +31,12 @@ chl_file = open("channels.txt", "r")
30
  channels = chl_file.read().split("\n")
31
  channel_btns = []
32
 
 
 
 
 
 
 
33
  def fill_up_placeholders(txt):
34
  placeholders = get_placeholders(txt)
35
  highlighted_txt = txt
 
1
  import os
2
+ import re
3
  import json
4
  import copy
5
  import gradio as gr
 
31
  channels = chl_file.read().split("\n")
32
  channel_btns = []
33
 
34
+ def get_placeholders(text):
35
+ """Returns all substrings in between <placeholder> and </placeholder>."""
36
+ pattern = r"\[([^\]]*)\]"
37
+ matches = re.findall(pattern, text)
38
+ return matches
39
+
40
  def fill_up_placeholders(txt):
41
  placeholders = get_placeholders(txt)
42
  highlighted_txt = txt