Spaces:
Runtime error
Runtime error
Delete src
Browse files- src/streamlit_app.py +0 -37
src/streamlit_app.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import base64
|
| 3 |
-
import pandas as pd
|
| 4 |
-
import os
|
| 5 |
-
|
| 6 |
-
# 1. 自动获取当前脚本的绝对路径 (例如 /app/src)
|
| 7 |
-
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 8 |
-
|
| 9 |
-
# 2. 修改读取函数:让它强制在脚本同级目录下找文件
|
| 10 |
-
def get_image_base64(image_name):
|
| 11 |
-
# 自动拼接绝对路径,不再依赖运行位置
|
| 12 |
-
full_path = os.path.join(BASE_DIR, image_name)
|
| 13 |
-
try:
|
| 14 |
-
with open(full_path, "rb") as f:
|
| 15 |
-
return base64.b64encode(f.read()).decode()
|
| 16 |
-
except FileNotFoundError:
|
| 17 |
-
# 调试信息:如果还是找不到,会在网页上显示它到底在哪个路径找的
|
| 18 |
-
st.error(f"文件缺失。请检查路径: {full_path}")
|
| 19 |
-
return ""
|
| 20 |
-
|
| 21 |
-
# 3. 在读取 CSV 的地方也要使用绝对路径
|
| 22 |
-
# df_full = pd.read_csv(os.path.join(BASE_DIR, "utils", "full_lb.csv"))
|
| 23 |
-
|
| 24 |
-
# ... 省略中间样式代码 ...
|
| 25 |
-
|
| 26 |
-
# 4. 调用处(只需传文件名)
|
| 27 |
-
title_icon = get_image_base64("title_icon.png")
|
| 28 |
-
|
| 29 |
-
# 5. 标题部分(确保包含了 <img> 标签来使用 base64 数据)
|
| 30 |
-
st.markdown(f"""
|
| 31 |
-
<div style="background-color: #f0f0f0; padding: 20px 20px; margin: 0 -30rem 20px -30rem;">
|
| 32 |
-
<h1 style="text-align: center; font-size: 36px;">
|
| 33 |
-
<img src="data:image/png;base64,{title_icon}" width="45" style="vertical-align: middle;">
|
| 34 |
-
RAGRouter-Bench:<br> A Dataset and Benchmark for Adaptive RAG Routing
|
| 35 |
-
</h1>
|
| 36 |
-
</div>
|
| 37 |
-
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|