sashank812 commited on
Commit
8c333a1
Β·
verified Β·
1 Parent(s): 88490b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -24
app.py CHANGED
@@ -46,9 +46,6 @@ import pptx
46
  import io
47
  from PIL import Image
48
 
49
- import comtypes.client
50
- import comtypes
51
-
52
  warnings.filterwarnings("ignore")
53
 
54
 
@@ -94,26 +91,6 @@ def extract_and_clean_text(file_path):
94
  elif file_path.endswith(".pptx"):
95
  from pptx import Presentation
96
 
97
- prs = Presentation(file_path)
98
- for slide in prs.slides:
99
- for shape in slide.shapes:
100
- if hasattr(shape, "text"):
101
- text += shape.text + " "
102
- elif file_path.endswith(".ppt"):
103
- comtypes.CoInitialize()
104
- try:
105
- powerpoint = comtypes.client.CreateObject("PowerPoint.Application")
106
- powerpoint.Visible = 1
107
- ppt = powerpoint.Presentations.Open(file_path)
108
- pptx_path = file_path + "x" # Save as .pptx
109
- ppt.SaveAs(pptx_path, 24) # 24 is the format for .pptx
110
- ppt.Close()
111
- powerpoint.Quit()
112
- file_path = pptx_path # Update file_path to the new .pptx file
113
- finally:
114
- comtypes.CoUninitialize()
115
- from pptx import Presentation
116
-
117
  prs = Presentation(file_path)
118
  for slide in prs.slides:
119
  for shape in slide.shapes:
@@ -393,7 +370,7 @@ with gr.Blocks() as demo:
393
  with gr.Column():
394
  file_upload = gr.Files(label="Upload Your Files")
395
  gr.Markdown(
396
- "### Supported File Types: πŸ“„ `.docx` πŸ“ `.txt` 🌐 `.html` πŸ“‘ `.pdf` πŸ“Š `.csv` πŸ“ˆ `.xlsx` πŸ—‚ `.json` πŸ—ƒ `.xml` 🎞 `.ppt/.pptx`",
397
  elem_id="file-types-info",
398
  )
399
  summarize_btn = gr.Button("Summarize")
 
46
  import io
47
  from PIL import Image
48
 
 
 
 
49
  warnings.filterwarnings("ignore")
50
 
51
 
 
91
  elif file_path.endswith(".pptx"):
92
  from pptx import Presentation
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  prs = Presentation(file_path)
95
  for slide in prs.slides:
96
  for shape in slide.shapes:
 
370
  with gr.Column():
371
  file_upload = gr.Files(label="Upload Your Files")
372
  gr.Markdown(
373
+ "### Supported File Types: πŸ“„ `.docx` πŸ“ `.txt` 🌐 `.html` πŸ“‘ `.pdf` πŸ“Š `.csv` πŸ“ˆ `.xlsx` πŸ—‚ `.json` πŸ—ƒ `.xml` 🎞 `.pptx`",
374
  elem_id="file-types-info",
375
  )
376
  summarize_btn = gr.Button("Summarize")