Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,30 @@ import pandas as pd
|
|
| 6 |
import sys
|
| 7 |
from pathlib import Path
|
| 8 |
|
| 9 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
from dotenv import load_dotenv
|
| 11 |
from huggingface_hub import login
|
| 12 |
from text_inspector_tool import TextInspectorTool
|
|
|
|
| 6 |
import sys
|
| 7 |
from pathlib import Path
|
| 8 |
|
| 9 |
+
# Fix cookies import by creating a module structure dynamically
|
| 10 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 11 |
+
if current_dir not in sys.path:
|
| 12 |
+
sys.path.insert(0, current_dir)
|
| 13 |
+
|
| 14 |
+
# Create __init__.py file if it doesn't exist
|
| 15 |
+
init_path = os.path.join(current_dir, "__init__.py")
|
| 16 |
+
if not os.path.exists(init_path):
|
| 17 |
+
with open(init_path, "w") as f:
|
| 18 |
+
f.write("") # Create empty __init__.py file
|
| 19 |
+
|
| 20 |
+
# Now imports should work
|
| 21 |
+
try:
|
| 22 |
+
from cookies import COOKIES
|
| 23 |
+
# Test the import to ensure it works
|
| 24 |
+
print("Successfully imported COOKIES")
|
| 25 |
+
except ImportError as e:
|
| 26 |
+
print(f"Error importing COOKIES: {e}")
|
| 27 |
+
# If import fails, try a direct import with modified sys.modules
|
| 28 |
+
import cookies
|
| 29 |
+
sys.modules[__name__ + '.cookies'] = cookies
|
| 30 |
+
print("Added cookies to sys.modules")
|
| 31 |
+
|
| 32 |
+
# Now the rest of your imports should work
|
| 33 |
from dotenv import load_dotenv
|
| 34 |
from huggingface_hub import login
|
| 35 |
from text_inspector_tool import TextInspectorTool
|