Spaces:
Paused
Paused
Fix Gradio version and import issues
Browse files
README.md
CHANGED
|
@@ -5,7 +5,7 @@ emoji: 📄
|
|
| 5 |
colorFrom: blue
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
-
sdk_version:
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
---
|
|
|
|
| 5 |
colorFrom: blue
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
+
sdk_version: 5.14.0
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
---
|
app.py
CHANGED
|
@@ -7,8 +7,23 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
| 7 |
# Add the current directory to the Python path
|
| 8 |
sys.path.append(current_dir)
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
if __name__ == "__main__":
|
| 14 |
main()
|
|
|
|
| 7 |
# Add the current directory to the Python path
|
| 8 |
sys.path.append(current_dir)
|
| 9 |
|
| 10 |
+
# Try different import approaches
|
| 11 |
+
try:
|
| 12 |
+
# First attempt - standard import
|
| 13 |
+
from src.main import main
|
| 14 |
+
except ModuleNotFoundError:
|
| 15 |
+
try:
|
| 16 |
+
# Second attempt - adjust path and try again
|
| 17 |
+
sys.path.append(os.path.join(current_dir, "src"))
|
| 18 |
+
from main import main
|
| 19 |
+
except ModuleNotFoundError:
|
| 20 |
+
# Third attempt - create __init__.py if it doesn't exist
|
| 21 |
+
init_path = os.path.join(current_dir, "src", "__init__.py")
|
| 22 |
+
if not os.path.exists(init_path):
|
| 23 |
+
with open(init_path, "w") as f:
|
| 24 |
+
pass # Create empty __init__.py file
|
| 25 |
+
# Try import again
|
| 26 |
+
from src.main import main
|
| 27 |
|
| 28 |
if __name__ == "__main__":
|
| 29 |
main()
|