pufanyi commited on
Commit
b351f32
1 Parent(s): a64e263

Refactor css_html_js.py to update Font Awesome version

Browse files
Files changed (3) hide show
  1. app.py +5 -2
  2. src/display/css_html_js.py +7 -2
  3. src/envs.py +2 -0
app.py CHANGED
@@ -21,6 +21,7 @@ from src.about import (
21
  from src.display.css_html_js import (
22
  custom_css,
23
  CSS_EXTERNAL,
 
24
  )
25
  from src.display.utils import (
26
  AutoEvalColumn,
@@ -153,10 +154,12 @@ HEAD = "".join(
153
  [
154
  f'<link rel="stylesheet" href="{css}">' for css in CSS_EXTERNAL
155
  ]
 
 
 
 
156
  )
157
 
158
- print("HEAD:", HEAD)
159
-
160
  demo = gr.Blocks(css=custom_css, head = HEAD)
161
  with demo:
162
  gr.HTML(TITLE)
 
21
  from src.display.css_html_js import (
22
  custom_css,
23
  CSS_EXTERNAL,
24
+ JS_EXTERNAL,
25
  )
26
  from src.display.utils import (
27
  AutoEvalColumn,
 
154
  [
155
  f'<link rel="stylesheet" href="{css}">' for css in CSS_EXTERNAL
156
  ]
157
+ +
158
+ [
159
+ f'<script src="{js}" crossorigin="anonymous"></script>' for js in JS_EXTERNAL
160
+ ]
161
  )
162
 
 
 
163
  demo = gr.Blocks(css=custom_css, head = HEAD)
164
  with demo:
165
  gr.HTML(TITLE)
src/display/css_html_js.py CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  custom_css = """
2
 
3
  .markdown-text {
@@ -108,6 +111,8 @@ get_window_url_params = """
108
  """
109
 
110
  CSS_EXTERNAL = [
111
- # "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"
112
- "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
 
 
113
  ]
 
1
+ from src.envs import FONTAWESOME_KIT
2
+
3
+
4
  custom_css = """
5
 
6
  .markdown-text {
 
111
  """
112
 
113
  CSS_EXTERNAL = [
114
+ ]
115
+
116
+ JS_EXTERNAL = [
117
+ f"https://kit.fontawesome.com/{FONTAWESOME_KIT}.js"
118
  ]
src/envs.py CHANGED
@@ -25,3 +25,5 @@ EVAL_REQUESTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-queue-bk")
25
  EVAL_RESULTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-results-bk")
26
 
27
  API = HfApi(token=TOKEN)
 
 
 
25
  EVAL_RESULTS_PATH_BACKEND = os.path.join(CACHE_PATH, "eval-results-bk")
26
 
27
  API = HfApi(token=TOKEN)
28
+
29
+ FONTAWESOME_KIT = os.getenv("FONTAWESOME_KIT", None)