pgits commited on
Commit
14dfe79
·
verified ·
1 Parent(s): 0cfcb40

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -1,25 +1,23 @@
1
  """
2
  HuggingFace Spaces entry point for ChatCal.ai
3
- Minimal changes - uses JWT sessions instead of Redis
4
  """
5
  import os
6
- import sys
7
  import uvicorn
8
 
9
- # Add the current directory to Python path for imports
10
- sys.path.insert(0, '/app')
11
-
12
  # Set HF-specific environment variables
13
  os.environ.setdefault("SESSION_BACKEND", "jwt")
14
  os.environ.setdefault("APP_ENV", "production")
15
- os.environ.setdefault("APP_PORT", "7860") # HF Spaces default port
16
-
17
- # Import after setting up the path
18
- from app.api.main import app
19
 
20
  if __name__ == "__main__":
 
 
 
 
21
  uvicorn.run(
22
- app,
23
  host="0.0.0.0",
24
- port=int(os.environ.get("APP_PORT", 7860))
25
- )
 
 
1
  """
2
  HuggingFace Spaces entry point for ChatCal.ai
3
+ v0.3.1 - Corrected for HF deployment
4
  """
5
  import os
 
6
  import uvicorn
7
 
 
 
 
8
  # Set HF-specific environment variables
9
  os.environ.setdefault("SESSION_BACKEND", "jwt")
10
  os.environ.setdefault("APP_ENV", "production")
11
+ os.environ.setdefault("PORT", "7860")
 
 
 
12
 
13
  if __name__ == "__main__":
14
+ # Change to the chatcal-ai directory where the app module is
15
+ os.chdir('/app/chatcal-ai')
16
+
17
+ # Run uvicorn with the correct module path
18
  uvicorn.run(
19
+ "app.api.main:app",
20
  host="0.0.0.0",
21
+ port=7860,
22
+ reload=False
23
+ )