Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -6,6 +6,15 @@ import time
|
|
| 6 |
import json
|
| 7 |
from datetime import datetime
|
| 8 |
from typing import Dict, List, Tuple
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Handle Python 3.13 compatibility issues with gradio/pydub
|
| 11 |
try:
|
|
@@ -361,11 +370,11 @@ if __name__ == "__main__":
|
|
| 361 |
|
| 362 |
print("\nLaunching Gradio interface...")
|
| 363 |
|
| 364 |
-
#
|
| 365 |
-
# Set share=True for remote/container environments where localhost isn't accessible
|
| 366 |
app.launch(
|
| 367 |
-
server_name="
|
| 368 |
server_port=7860,
|
| 369 |
-
share=
|
|
|
|
| 370 |
show_error=True
|
| 371 |
)
|
|
|
|
| 6 |
import json
|
| 7 |
from datetime import datetime
|
| 8 |
from typing import Dict, List, Tuple
|
| 9 |
+
from dotenv import load_dotenv
|
| 10 |
+
|
| 11 |
+
# Load environment variables from .env file
|
| 12 |
+
load_dotenv()
|
| 13 |
+
|
| 14 |
+
# Set HF token from .env if available
|
| 15 |
+
if os.getenv('HF_TOKEN'):
|
| 16 |
+
os.environ['HF_TOKEN'] = os.getenv('HF_TOKEN')
|
| 17 |
+
os.environ['HUGGING_FACE_HUB_TOKEN'] = os.getenv('HF_TOKEN')
|
| 18 |
|
| 19 |
# Handle Python 3.13 compatibility issues with gradio/pydub
|
| 20 |
try:
|
|
|
|
| 370 |
|
| 371 |
print("\nLaunching Gradio interface...")
|
| 372 |
|
| 373 |
+
# Run locally without share (no HF token needed)
|
|
|
|
| 374 |
app.launch(
|
| 375 |
+
server_name="127.0.0.1",
|
| 376 |
server_port=7860,
|
| 377 |
+
share=False, # Disabled to avoid HF token issues
|
| 378 |
+
inbrowser=True, # Opens browser automatically
|
| 379 |
show_error=True
|
| 380 |
)
|