Update app.py
Browse files
app.py
CHANGED
@@ -8,17 +8,25 @@ import gradio as gr
|
|
8 |
libraries = [
|
9 |
'transformers',
|
10 |
'gradio',
|
11 |
-
'
|
12 |
-
'python-pptx', # Correct name for pptx library
|
13 |
]
|
14 |
|
15 |
-
|
16 |
for library in libraries:
|
17 |
try:
|
18 |
subprocess.check_call(['pip', 'install', library])
|
19 |
except subprocess.CalledProcessError as e:
|
20 |
print(f"Error installing {library}: {e}")
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
def extract_text_from_pptx(file_path):
|
23 |
presentation = Presentation(file_path)
|
24 |
|
|
|
8 |
libraries = [
|
9 |
'transformers',
|
10 |
'gradio',
|
11 |
+
'python-pptx',
|
|
|
12 |
]
|
13 |
|
|
|
14 |
for library in libraries:
|
15 |
try:
|
16 |
subprocess.check_call(['pip', 'install', library])
|
17 |
except subprocess.CalledProcessError as e:
|
18 |
print(f"Error installing {library}: {e}")
|
19 |
|
20 |
+
# Now try to import the libraries
|
21 |
+
try:
|
22 |
+
from pptx import Presentation
|
23 |
+
import re
|
24 |
+
from transformers import pipeline
|
25 |
+
import gradio as gr
|
26 |
+
except ImportError as e:
|
27 |
+
print(f"Error importing required libraries: {e}")
|
28 |
+
exit(1)
|
29 |
+
|
30 |
def extract_text_from_pptx(file_path):
|
31 |
presentation = Presentation(file_path)
|
32 |
|