update pptx
Browse files
app.py
CHANGED
@@ -247,13 +247,13 @@ def extract_text_from_ppt(file_path):
|
|
247 |
return "Error extracting text from PPT file"
|
248 |
|
249 |
|
250 |
-
def extract_text_from_ppt_or_pptx(file_path):
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
|
258 |
|
259 |
def convert_pdf_to_image(file):
|
@@ -412,12 +412,12 @@ doc_or_docx_to_text = gr.Interface(
|
|
412 |
api_name="doc_or_docx_to_text",
|
413 |
)
|
414 |
|
415 |
-
pptx_or_ppt_to_text = gr.Interface(
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
)
|
421 |
|
422 |
ppt_to_text = gr.Interface(
|
423 |
extract_text_from_ppt,
|
@@ -426,6 +426,12 @@ ppt_to_text = gr.Interface(
|
|
426 |
api_name="ppt_to_text",
|
427 |
)
|
428 |
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
str_to_json = gr.Interface(
|
430 |
sanitize_list_of_lists,
|
431 |
gr.Text(),
|
@@ -452,13 +458,13 @@ url_parser = gr.Interface(
|
|
452 |
api_name="url_to_text",
|
453 |
)
|
454 |
demo = gr.TabbedInterface(
|
455 |
-
[pdf_to_img, pdf_to_text, doc_or_docx_to_text,
|
456 |
[
|
457 |
"PDF to Image",
|
458 |
"Extract PDF Text",
|
459 |
"Extract DOC/DOCX Text",
|
460 |
-
"Extract PPTX/PPT Text",
|
461 |
"Extract PPT Text",
|
|
|
462 |
"Extract text from URL",
|
463 |
"Extract Json",
|
464 |
],
|
|
|
247 |
return "Error extracting text from PPT file"
|
248 |
|
249 |
|
250 |
+
# def extract_text_from_ppt_or_pptx(file_path):
|
251 |
+
# if file_path.endswith(".pptx"):
|
252 |
+
# return extract_text_from_pptx(file_path)
|
253 |
+
# elif file_path.endswith(".ppt"):
|
254 |
+
# return extract_text_from_ppt(file_path)
|
255 |
+
# else:
|
256 |
+
# return "Unsupported file type. Please provide a .ppt or .pptx file."
|
257 |
|
258 |
|
259 |
def convert_pdf_to_image(file):
|
|
|
412 |
api_name="doc_or_docx_to_text",
|
413 |
)
|
414 |
|
415 |
+
# pptx_or_ppt_to_text = gr.Interface(
|
416 |
+
# extract_text_from_ppt_or_pptx,
|
417 |
+
# gr.File(),
|
418 |
+
# gr.Textbox(placeholder="Extracted text from PPTX will appear here"),
|
419 |
+
# api_name="pptx_or_ppt_to_text",
|
420 |
+
# )
|
421 |
|
422 |
ppt_to_text = gr.Interface(
|
423 |
extract_text_from_ppt,
|
|
|
426 |
api_name="ppt_to_text",
|
427 |
)
|
428 |
|
429 |
+
pptx_to_text = gr.Interface(
|
430 |
+
extract_text_from_pptx,
|
431 |
+
gr.File(),
|
432 |
+
gr.Textbox(),
|
433 |
+
api_name="pptx_to_text",
|
434 |
+
)
|
435 |
str_to_json = gr.Interface(
|
436 |
sanitize_list_of_lists,
|
437 |
gr.Text(),
|
|
|
458 |
api_name="url_to_text",
|
459 |
)
|
460 |
demo = gr.TabbedInterface(
|
461 |
+
[pdf_to_img, pdf_to_text, doc_or_docx_to_text, ppt_to_text, pptx_to_text, url_parser, str_to_json],
|
462 |
[
|
463 |
"PDF to Image",
|
464 |
"Extract PDF Text",
|
465 |
"Extract DOC/DOCX Text",
|
|
|
466 |
"Extract PPT Text",
|
467 |
+
"Extract PPTX Text",
|
468 |
"Extract text from URL",
|
469 |
"Extract Json",
|
470 |
],
|