bibibi12345 commited on
Commit
907db72
·
1 Parent(s): b6eebc3

added animation frontend

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -1
  2. main.py +5 -1
Dockerfile CHANGED
@@ -10,8 +10,9 @@ COPY requirements.txt .
10
  # Install any needed packages specified in requirements.txt
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Copy the main application file to the working directory
14
  COPY main.py .
 
15
 
16
  # Make port 7860 available to the world outside this container
17
  EXPOSE 7860
 
10
  # Install any needed packages specified in requirements.txt
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Copy the application files to the working directory
14
  COPY main.py .
15
+ COPY index.html .
16
 
17
  # Make port 7860 available to the world outside this container
18
  EXPOSE 7860
main.py CHANGED
@@ -8,6 +8,7 @@ from fastapi.staticfiles import StaticFiles
8
  from itertools import cycle
9
  import asyncio
10
  import json
 
11
 
12
  # --- Configuration ---
13
  PROXY_API_KEY = os.environ.get("PROXY_API_KEY")
@@ -69,7 +70,10 @@ async def get_project_id(key: str):
69
  # --- Frontend Route ---
70
  @app.get("/")
71
  async def frontend():
72
- return FileResponse("index.html")
 
 
 
73
 
74
  # --- Proxy Endpoint ---
75
  @app.post("/v1beta/models/{model_path:path}")
 
8
  from itertools import cycle
9
  import asyncio
10
  import json
11
+ from pathlib import Path
12
 
13
  # --- Configuration ---
14
  PROXY_API_KEY = os.environ.get("PROXY_API_KEY")
 
70
  # --- Frontend Route ---
71
  @app.get("/")
72
  async def frontend():
73
+ # Get the directory where this script is located
74
+ current_dir = Path(__file__).parent
75
+ html_path = current_dir / "index.html"
76
+ return FileResponse(html_path)
77
 
78
  # --- Proxy Endpoint ---
79
  @app.post("/v1beta/models/{model_path:path}")