Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,15 +4,22 @@ import time
|
|
| 4 |
import sys
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
-
# ---
|
| 8 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 9 |
MODULES_DIR = os.path.join(BASE_DIR, "modules")
|
| 10 |
-
if MODULES_DIR not in sys.path:
|
| 11 |
sys.path.insert(0, MODULES_DIR)
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
APP_NAME = "Auto-PPT Generator"
|
| 18 |
|
|
|
|
| 4 |
import sys
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
+
# --- Ensure we can import modules whether it's a package or a plain folder ---
|
| 8 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 9 |
MODULES_DIR = os.path.join(BASE_DIR, "modules")
|
| 10 |
+
if os.path.isdir(MODULES_DIR) and MODULES_DIR not in sys.path:
|
| 11 |
sys.path.insert(0, MODULES_DIR)
|
| 12 |
|
| 13 |
+
try:
|
| 14 |
+
# Prefer package-style if modules/__init__.py exists
|
| 15 |
+
from modules.text_processing import process_text
|
| 16 |
+
from modules.pptx_builder import build_presentation
|
| 17 |
+
from modules.utils import safe_hex_to_rgb, ensure_tmpdir
|
| 18 |
+
except ModuleNotFoundError:
|
| 19 |
+
# Fallback: flat imports from ./modules added to sys.path
|
| 20 |
+
from text_processing import process_text
|
| 21 |
+
from pptx_builder import build_presentation
|
| 22 |
+
from utils import safe_hex_to_rgb, ensure_tmpdir
|
| 23 |
|
| 24 |
APP_NAME = "Auto-PPT Generator"
|
| 25 |
|