napatswift commited on
Commit
a845606
·
1 Parent(s): d8b4543
Files changed (2) hide show
  1. app.py +3 -3
  2. requirements.txt +0 -1
app.py CHANGED
@@ -47,15 +47,15 @@ def download_pdf(url):
47
  # Return the path to the downloaded file
48
  return os.path.abspath(filename)
49
 
50
- def greet(pdf_file: gr.File, link: str, replacer_string):
51
- if pdf_file is None and link is None:
52
  return "# Please updload file or link to ratchakitcha file", "Please add file"
53
 
54
  if not replacer_string: replacer_string = ' ำ=ำ, า=ำ,้หนา=หน้า,่เลม=เล่ม,๐=0,๑=1,๒=2,๓=3,๔=4,๕=5,๖=6,๗=7,๘=8,๙=9'
55
  if pdf_file:
56
  pdf_path = pdf_file.name
57
  else:
58
- pdf_path = download_pdf()
59
  doc = fitz.open(pdf_path)
60
  md_string = read_lines(doc)
61
  replacer = re.findall('(([^=]*)=([^,]*),?)', replacer_string)
 
47
  # Return the path to the downloaded file
48
  return os.path.abspath(filename)
49
 
50
+ def greet(pdf_file: gr.File, pdf_url: str, replacer_string):
51
+ if pdf_file is None and pdf_url is None:
52
  return "# Please updload file or link to ratchakitcha file", "Please add file"
53
 
54
  if not replacer_string: replacer_string = ' ำ=ำ, า=ำ,้หนา=หน้า,่เลม=เล่ม,๐=0,๑=1,๒=2,๓=3,๔=4,๕=5,๖=6,๗=7,๘=8,๙=9'
55
  if pdf_file:
56
  pdf_path = pdf_file.name
57
  else:
58
+ pdf_path = download_pdf(pdf_url)
59
  doc = fitz.open(pdf_path)
60
  md_string = read_lines(doc)
61
  replacer = re.findall('(([^=]*)=([^,]*),?)', replacer_string)
requirements.txt CHANGED
@@ -1,2 +1 @@
1
  pymupdf
2
- gradio
 
1
  pymupdf