baba521 commited on
Commit
21c59a8
·
1 Parent(s): d46d015
Files changed (1) hide show
  1. app.py +23 -8
app.py CHANGED
@@ -1668,18 +1668,33 @@ def main():
1668
  # 获取当前目录
1669
  current_dir = os.path.dirname(os.path.abspath(__file__))
1670
  css_dir = os.path.join(current_dir, "css")
1671
-
 
 
 
 
 
 
 
 
 
 
 
1672
  # 设置CSS路径
1673
- css_paths = [
1674
- os.path.join(css_dir, "main.css"),
1675
- os.path.join(css_dir, "components.css"),
1676
- os.path.join(css_dir, "layout.css")
1677
- ]
 
 
 
1678
 
1679
  with gr.Blocks(
1680
  title="Financial Analysis Dashboard",
1681
- css_paths=css_paths,
1682
- css=custom_css,
 
1683
  ) as demo:
1684
 
1685
  # 添加处理公司点击事件的路由
 
1668
  # 获取当前目录
1669
  current_dir = os.path.dirname(os.path.abspath(__file__))
1670
  css_dir = os.path.join(current_dir, "css")
1671
+
1672
+ def load_css_files(css_dir, filenames):
1673
+ """读取多个 CSS 文件并合并为一个字符串"""
1674
+ css_content = ""
1675
+ for filename in filenames:
1676
+ path = os.path.join(css_dir, filename)
1677
+ if os.path.exists(path):
1678
+ with open(path, "r", encoding="utf-8") as f:
1679
+ css_content += f.read() + "\n"
1680
+ else:
1681
+ print(f"Warning: CSS file not found: {path}")
1682
+ return css_content
1683
  # 设置CSS路径
1684
+ # css_paths = [
1685
+ # os.path.join(css_dir, "main.css"),
1686
+ # os.path.join(css_dir, "components.css"),
1687
+ # os.path.join(css_dir, "layout.css")
1688
+ # ]
1689
+ css_dir = "path/to/your/css/folder" # 替换为你的实际路径
1690
+ css_files = ["main.css", "components.css", "layout.css"]
1691
+ combined_css = load_css_files(css_dir, css_files)
1692
 
1693
  with gr.Blocks(
1694
  title="Financial Analysis Dashboard",
1695
+ # css_paths=css_paths,
1696
+ # css=custom_css,
1697
+ css=combined_css
1698
  ) as demo:
1699
 
1700
  # 添加处理公司点击事件的路由