SayedZahur786 commited on
Commit
dde9859
·
1 Parent(s): ee6d55e

Add favicon support to frontend

Browse files
Files changed (2) hide show
  1. backend/main.py +9 -0
  2. backend/static/index.html +3 -0
backend/main.py CHANGED
@@ -43,6 +43,8 @@ app = FastAPI()
43
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
44
  MEDIA_DIR = os.path.join(BASE_DIR, "media")
45
  STATIC_DIR = os.path.join(BASE_DIR, "static")
 
 
46
 
47
  # Ensure the media directory exists
48
  os.makedirs(MEDIA_DIR, exist_ok=True)
@@ -139,6 +141,13 @@ async def process_video_generation(prompt: str):
139
  async def read_index():
140
  return FileResponse(os.path.join(STATIC_DIR, 'index.html'))
141
 
 
 
 
 
 
 
 
142
  @app.post("/generate")
143
  async def generate_video(request: PromptRequest, background_tasks: BackgroundTasks):
144
  global job_status
 
43
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
44
  MEDIA_DIR = os.path.join(BASE_DIR, "media")
45
  STATIC_DIR = os.path.join(BASE_DIR, "static")
46
+ # Root directory (parent of backend/)
47
+ ROOT_DIR = os.path.dirname(BASE_DIR)
48
 
49
  # Ensure the media directory exists
50
  os.makedirs(MEDIA_DIR, exist_ok=True)
 
141
  async def read_index():
142
  return FileResponse(os.path.join(STATIC_DIR, 'index.html'))
143
 
144
+ @app.get("/favicon.ico")
145
+ async def get_favicon():
146
+ favicon_path = os.path.join(ROOT_DIR, 'favicon.ico')
147
+ if os.path.exists(favicon_path):
148
+ return FileResponse(favicon_path)
149
+ raise HTTPException(status_code=404, detail="Favicon not found")
150
+
151
  @app.post("/generate")
152
  async def generate_video(request: PromptRequest, background_tasks: BackgroundTasks):
153
  global job_status
backend/static/index.html CHANGED
@@ -7,6 +7,9 @@
7
  content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
8
  />
9
  <title>Animetrix AI | AI Animation Engine</title>
 
 
 
10
 
11
  <!-- Fonts: Inter (Modern, Clean) -->
12
  <link rel="preconnect" href="https://fonts.googleapis.com" />
 
7
  content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
8
  />
9
  <title>Animetrix AI | AI Animation Engine</title>
10
+
11
+ <!-- Favicon -->
12
+ <link rel="icon" type="image/x-icon" href="/favicon.ico" />
13
 
14
  <!-- Fonts: Inter (Modern, Clean) -->
15
  <link rel="preconnect" href="https://fonts.googleapis.com" />