Skip to content

Commit 1ec62d9

Browse files
authored
fixed favicon issue (#1064)
* fixed favicon issue * routes * added default favicon
1 parent e77a6a7 commit 1ec62d9

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

gradio/blocks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def __init__(
235235

236236
self.ip_address = utils.get_local_ip_address()
237237
self.is_space = True if os.getenv("SYSTEM") == "spaces" else False
238+
self.favicon_path = None
238239

239240
def render(self):
240241
self._id = Context.id

gradio/routes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ def build_resource(path: str):
192192
return FileResponse(build_file)
193193
raise HTTPException(status_code=404, detail="Build file not found")
194194

195+
@app.get("/favicon.ico")
196+
async def favicon():
197+
if app.blocks.favicon_path is None:
198+
return static_resource("img/logo.svg")
199+
else:
200+
return FileResponse(app.blocks.favicon_path)
201+
195202
@app.get("/file/{path:path}", dependencies=[Depends(login_check)])
196203
def file(path):
197204
if (

0 commit comments

Comments
 (0)