TIMBOVILL commited on
Commit
527574d
·
verified ·
1 Parent(s): 8230948

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py CHANGED
@@ -1481,6 +1481,31 @@ def zip_downloader(model):
1481
  else:
1482
  return f'./weights/{model}.pth', "Could not find Index file."
1483
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1484
  my_theme = gr.Theme.from_hub("ParityError/LimeFace")
1485
 
1486
  with gr.Blocks(theme=my_theme) as app:
@@ -1864,6 +1889,10 @@ with gr.Blocks(theme=my_theme) as app:
1864
  # """
1865
  # )
1866
 
 
 
 
 
1867
  def has_two_files_in_pretrained_folder():
1868
  pretrained_folder = "./pretrained/"
1869
  if not os.path.exists(pretrained_folder):
 
1481
  else:
1482
  return f'./weights/{model}.pth', "Could not find Index file."
1483
 
1484
+ def remove_invalid_chars(text):
1485
+ pattern = re.compile(r"[^\x00-\x7F]+")
1486
+ return pattern.sub("", text)
1487
+
1488
+
1489
+ def remove_text_between_parentheses(lines, start_line, end_line):
1490
+ pattern = r"\[([^\]]*)\]\([^)]*\)"
1491
+ processed_lines = []
1492
+ for line_number, line in enumerate(lines, start=1):
1493
+ if start_line <= line_number <= end_line:
1494
+ modified_line = re.sub(pattern, r"\1", line)
1495
+ processed_lines.append(modified_line)
1496
+ else:
1497
+ processed_lines.append(line)
1498
+
1499
+ return "\n".join(processed_lines)
1500
+
1501
+
1502
+ with open("README.md", "r", encoding="utf8") as f:
1503
+ inforeadme = f.read()
1504
+
1505
+ inforeadme = remove_text_between_parentheses(inforeadme.split("\n"), 6, 17)
1506
+ inforeadme = remove_invalid_chars(inforeadme)
1507
+ inforeadme = remove_text_between_parentheses(inforeadme.split("\n"), 191, 207)
1508
+
1509
  my_theme = gr.Theme.from_hub("ParityError/LimeFace")
1510
 
1511
  with gr.Blocks(theme=my_theme) as app:
 
1889
  # """
1890
  # )
1891
 
1892
+ with gr.TabItem(i18n("Readme")):
1893
+ gr.Markdown(value=inforeadme)
1894
+ return app
1895
+
1896
  def has_two_files_in_pretrained_folder():
1897
  pretrained_folder = "./pretrained/"
1898
  if not os.path.exists(pretrained_folder):