seanpedrickcase commited on
Commit
69db69f
·
1 Parent(s): 1ae2284

Added support for a custom favicon. Although this is not actually applying, so hopefully an upcoming Gradio version will resolve this

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. app.py +7 -2
  3. favicon.ico +3 -0
  4. tools/config.py +2 -0
.gitattributes CHANGED
@@ -5,3 +5,4 @@
5
  *.docx filter=lfs diff=lfs merge=lfs -text
6
  *.doc filter=lfs diff=lfs merge=lfs -text
7
  *.png filter=lfs diff=lfs merge=lfs -text
 
 
5
  *.docx filter=lfs diff=lfs merge=lfs -text
6
  *.doc filter=lfs diff=lfs merge=lfs -text
7
  *.png filter=lfs diff=lfs merge=lfs -text
8
+ *.ico filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
 
3
  import gradio as gr
4
  import pandas as pd
@@ -61,6 +62,7 @@ from tools.config import (
61
  ENFORCE_COST_CODES,
62
  EXTRACTION_AND_PII_OPTIONS_OPEN_BY_DEFAULT,
63
  FASTAPI_ROOT_PATH,
 
64
  FEEDBACK_LOG_DYNAMODB_TABLE_NAME,
65
  FEEDBACK_LOG_FILE_NAME,
66
  FEEDBACK_LOGS_FOLDER,
@@ -6403,11 +6405,12 @@ with blocks:
6403
  show_error=True,
6404
  auth=authenticate_user if COGNITO_AUTH == "1" else None,
6405
  max_file_size=MAX_FILE_SIZE,
6406
- # root_path=ROOT_PATH, # Not necessary
6407
  path=FASTAPI_ROOT_PATH,
 
6408
  )
6409
 
6410
- # Example command to run in uvicorn: uvicorn.run("app:app", host=GRADIO_SERVER_NAME, port=GRADIO_SERVER_PORT)
 
6411
 
6412
  else:
6413
  if __name__ == "__main__":
@@ -6420,6 +6423,7 @@ with blocks:
6420
  server_name=GRADIO_SERVER_NAME,
6421
  server_port=GRADIO_SERVER_PORT,
6422
  root_path=ROOT_PATH,
 
6423
  )
6424
  else:
6425
  blocks.launch(
@@ -6429,6 +6433,7 @@ with blocks:
6429
  server_name=GRADIO_SERVER_NAME,
6430
  server_port=GRADIO_SERVER_PORT,
6431
  root_path=ROOT_PATH,
 
6432
  )
6433
 
6434
  else:
 
1
  import os
2
+ from pathlib import Path
3
 
4
  import gradio as gr
5
  import pandas as pd
 
62
  ENFORCE_COST_CODES,
63
  EXTRACTION_AND_PII_OPTIONS_OPEN_BY_DEFAULT,
64
  FASTAPI_ROOT_PATH,
65
+ FAVICON_PATH,
66
  FEEDBACK_LOG_DYNAMODB_TABLE_NAME,
67
  FEEDBACK_LOG_FILE_NAME,
68
  FEEDBACK_LOGS_FOLDER,
 
6405
  show_error=True,
6406
  auth=authenticate_user if COGNITO_AUTH == "1" else None,
6407
  max_file_size=MAX_FILE_SIZE,
 
6408
  path=FASTAPI_ROOT_PATH,
6409
+ favicon_path=Path(FAVICON_PATH),
6410
  )
6411
 
6412
+ # Example command to run in uvicorn (in python): uvicorn.run("app:app", host=GRADIO_SERVER_NAME, port=GRADIO_SERVER_PORT)
6413
+ # In command line something like: uvicorn app:app --host=0.0.0.0 --port=7860
6414
 
6415
  else:
6416
  if __name__ == "__main__":
 
6423
  server_name=GRADIO_SERVER_NAME,
6424
  server_port=GRADIO_SERVER_PORT,
6425
  root_path=ROOT_PATH,
6426
+ favicon_path=Path(FAVICON_PATH),
6427
  )
6428
  else:
6429
  blocks.launch(
 
6433
  server_name=GRADIO_SERVER_NAME,
6434
  server_port=GRADIO_SERVER_PORT,
6435
  root_path=ROOT_PATH,
6436
+ favicon_path=Path(FAVICON_PATH),
6437
  )
6438
 
6439
  else:
favicon.ico ADDED

Git LFS Details

  • SHA256: 9a07796e8d2381ff523d9aad719b8ee1f54d17d9857f2c23a09511a2e32e6338
  • Pointer size: 130 Bytes
  • Size of remote file: 15.4 kB
tools/config.py CHANGED
@@ -255,6 +255,8 @@ FEEDBACK_LOG_FILE_NAME = get_or_create_env_var("FEEDBACK_LOG_FILE_NAME", LOG_FIL
255
  # Gradio general app options
256
  ###
257
 
 
 
258
  RUN_FASTAPI = get_or_create_env_var("RUN_FASTAPI", "0")
259
 
260
  MAX_QUEUE_SIZE = int(get_or_create_env_var("MAX_QUEUE_SIZE", "5"))
 
255
  # Gradio general app options
256
  ###
257
 
258
+ FAVICON_PATH = get_or_create_env_var("FAVICON_PATH", "favicon.ico")
259
+
260
  RUN_FASTAPI = get_or_create_env_var("RUN_FASTAPI", "0")
261
 
262
  MAX_QUEUE_SIZE = int(get_or_create_env_var("MAX_QUEUE_SIZE", "5"))