Spaces:
Runtime error
Runtime error
napatswift
commited on
Commit
·
097da64
1
Parent(s):
2872dd7
Update
Browse files
app.py
CHANGED
@@ -67,7 +67,7 @@ def greet(pdf_file: gr.File, pdf_url: str, replacer_string):
|
|
67 |
return md_string, md_string
|
68 |
|
69 |
def get_metainfo(md_string):
|
70 |
-
pattern = 'หน้า \d+\s+เล่ม (\d+)
|
71 |
info = re.findall(pattern, md_string)
|
72 |
pattern = '(หน้า \d+\s+เล่ม \d+ ตอนที่ \d+ [ก-ฮ]+ ราชกิจจานุเบกษา \d+ [^\s]+ \d+)\s+'
|
73 |
if not info: return md_string
|
@@ -111,7 +111,7 @@ def read_lines(doc):
|
|
111 |
|
112 |
demo = gr.Interface(fn=greet,
|
113 |
inputs=[gr.File(), gr.Text(), gr.Text(interactive=True)],
|
114 |
-
outputs=[gr.
|
115 |
examples=[[None,
|
116 |
'https://ratchakitcha.soc.go.th/documents/140A014N0000000002600.pdf',
|
117 |
' ำ=ำ, า=ำ,้หนา=หน้า,่เลม=เล่ม,๐=0,๑=1,๒=2,๓=3,๔=4,๕=5,๖=6,๗=7,๘=8,๙=9'
|
|
|
67 |
return md_string, md_string
|
68 |
|
69 |
def get_metainfo(md_string):
|
70 |
+
pattern = 'หน้า \d+\s+เล่ม (\d+) ตอน[^\s]+ (\d+) ([ก-ฮ]+) ราชกิจจานุเบกษา (\d+) ([^\s]+) (\d+)\s+'
|
71 |
info = re.findall(pattern, md_string)
|
72 |
pattern = '(หน้า \d+\s+เล่ม \d+ ตอนที่ \d+ [ก-ฮ]+ ราชกิจจานุเบกษา \d+ [^\s]+ \d+)\s+'
|
73 |
if not info: return md_string
|
|
|
111 |
|
112 |
demo = gr.Interface(fn=greet,
|
113 |
inputs=[gr.File(), gr.Text(), gr.Text(interactive=True)],
|
114 |
+
outputs=[gr.TextArea(), gr.Markdown()],
|
115 |
examples=[[None,
|
116 |
'https://ratchakitcha.soc.go.th/documents/140A014N0000000002600.pdf',
|
117 |
' ำ=ำ, า=ำ,้หนา=หน้า,่เลม=เล่ม,๐=0,๑=1,๒=2,๓=3,๔=4,๕=5,๖=6,๗=7,๘=8,๙=9'
|