baba521 commited on
Commit
130f040
·
1 Parent(s): 21c59a8
Files changed (1) hide show
  1. app.py +28 -14
app.py CHANGED
@@ -1663,32 +1663,46 @@ def create_chat_panel():
1663
  queue=True,
1664
  )
1665
 
1666
-
 
 
 
 
 
 
 
 
 
1667
  def main():
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",
 
1663
  queue=True,
1664
  )
1665
 
1666
+ def load_css_files(css_dir, filenames):
1667
+ css_content = ""
1668
+ for filename in filenames:
1669
+ path = os.path.join(css_dir, filename)
1670
+ if os.path.exists(path):
1671
+ with open(path, "r", encoding="utf-8") as f:
1672
+ css_content += f.read() + "\n"
1673
+ else:
1674
+ print(f"⚠️ CSS file not found: {path}")
1675
+ return css_content
1676
  def main():
1677
  # 获取当前目录
1678
  current_dir = os.path.dirname(os.path.abspath(__file__))
1679
  css_dir = os.path.join(current_dir, "css")
1680
 
1681
+ # def load_css_files(css_dir, filenames):
1682
+ # """读取多个 CSS 文件并合并为一个字符串"""
1683
+ # css_content = ""
1684
+ # for filename in filenames:
1685
+ # path = os.path.join(css_dir, filename)
1686
+ # if os.path.exists(path):
1687
+ # with open(path, "r", encoding="utf-8") as f:
1688
+ # css_content += f.read() + "\n"
1689
+ # else:
1690
+ # print(f"Warning: CSS file not found: {path}")
1691
+ # return css_content
1692
  # 设置CSS路径
1693
  # css_paths = [
1694
  # os.path.join(css_dir, "main.css"),
1695
  # os.path.join(css_dir, "components.css"),
1696
  # os.path.join(css_dir, "layout.css")
1697
  # ]
1698
+ # css_dir = "path/to/your/css/folder" # 替换为你的实际路径
1699
+ # 自动定位 css 文件夹(与 app.py 同级)
1700
+ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
1701
+ CSS_DIR = os.path.join(BASE_DIR, "css")
1702
+
1703
  css_files = ["main.css", "components.css", "layout.css"]
1704
+ combined_css = load_css_files(CSS_DIR, css_files)
1705
+ print(combined_css)
1706
 
1707
  with gr.Blocks(
1708
  title="Financial Analysis Dashboard",