Spaces:
Runtime error
Runtime error
Davidsamuel101
commited on
Commit
·
b85773b
1
Parent(s):
8c2d251
Main
Browse files- __pycache__/app.cpython-38.pyc +0 -0
- __pycache__/text_extractor.cpython-38.pyc +0 -0
- app.py +7 -6
__pycache__/app.cpython-38.pyc
CHANGED
Binary files a/__pycache__/app.cpython-38.pyc and b/__pycache__/app.cpython-38.pyc differ
|
|
__pycache__/text_extractor.cpython-38.pyc
CHANGED
Binary files a/__pycache__/text_extractor.cpython-38.pyc and b/__pycache__/text_extractor.cpython-38.pyc differ
|
|
app.py
CHANGED
@@ -36,7 +36,6 @@ def summarize(slides):
|
|
36 |
|
37 |
|
38 |
def convert2markdown(generate_slides):
|
39 |
-
# save_path = f"tmp/{FILENAME}"
|
40 |
mdFile = MdUtils(file_name=FILENAME, title=f'{FILENAME} Presentation')
|
41 |
for k, v in generate_slides.items():
|
42 |
mdFile.new_paragraph('---')
|
@@ -54,6 +53,7 @@ def convert2markdown(generate_slides):
|
|
54 |
|
55 |
def inference(document):
|
56 |
global FILENAME
|
|
|
57 |
doc = fitz.open(document)
|
58 |
FILENAME = Path(doc.name).stem
|
59 |
font_counts, styles = preprocess.get_font_info(doc, granularity=False)
|
@@ -62,14 +62,15 @@ def inference(document):
|
|
62 |
slides = preprocess.get_slides(texts)
|
63 |
generated_slides = summarize(slides)
|
64 |
markdown_path = convert2markdown(generated_slides)
|
65 |
-
with open(markdown_path, 'rt') as f:
|
66 |
-
|
67 |
-
return
|
68 |
|
69 |
|
70 |
with gr.Blocks() as demo:
|
71 |
-
inp = gr.File(
|
72 |
-
out = gr.
|
|
|
73 |
inference_btn = gr.Button("Summarized PDF")
|
74 |
inference_btn.click(fn=inference, inputs=inp, outputs=out, show_progress=True, api_name="summarize")
|
75 |
|
|
|
36 |
|
37 |
|
38 |
def convert2markdown(generate_slides):
|
|
|
39 |
mdFile = MdUtils(file_name=FILENAME, title=f'{FILENAME} Presentation')
|
40 |
for k, v in generate_slides.items():
|
41 |
mdFile.new_paragraph('---')
|
|
|
53 |
|
54 |
def inference(document):
|
55 |
global FILENAME
|
56 |
+
print(document)
|
57 |
doc = fitz.open(document)
|
58 |
FILENAME = Path(doc.name).stem
|
59 |
font_counts, styles = preprocess.get_font_info(doc, granularity=False)
|
|
|
62 |
slides = preprocess.get_slides(texts)
|
63 |
generated_slides = summarize(slides)
|
64 |
markdown_path = convert2markdown(generated_slides)
|
65 |
+
# with open(markdown_path, 'rt') as f:
|
66 |
+
# markdown_str = f.read()
|
67 |
+
return markdown_path
|
68 |
|
69 |
|
70 |
with gr.Blocks() as demo:
|
71 |
+
inp = gr.File(file_types=['pdf'])
|
72 |
+
out = gr.File(label="Markdown File")
|
73 |
+
# out = gr.Textbox(label="Markdown Content")
|
74 |
inference_btn = gr.Button("Summarized PDF")
|
75 |
inference_btn.click(fn=inference, inputs=inp, outputs=out, show_progress=True, api_name="summarize")
|
76 |
|