Spaces:
Runtime error
Runtime error
Download app.py from hou/FinSafetyBench-Leaderboard: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/spaces/hou/FinSafetyBench-Leaderboard/resolve/main/app.py
- Command line
-
hf download hf://spaces/hou/FinSafetyBench-Leaderboard/app.py
-
curl -L -o app.py https://huggingface.co/spaces/hou/FinSafetyBench-Leaderboard/resolve/main/app.py
1.41 kB
| import gradio as gr | |
| import pandas as pd | |
| csv_path = "results.csv" | |
| def load_data(): | |
| df = pd.read_csv(csv_path) | |
| df['Overall Avg ASR'] = df[['Crime (En)', 'Crime (Zh)', 'Ethical (En)', 'Ethical (Zh)']].mean(axis=1).round(2) | |
| df = df.sort_values(by='Overall Avg ASR', ascending=True) | |
| return df | |
| with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo: | |
| gr.Markdown( | |
| """ | |
| # π FinSafetyBench Leaderboard | |
| **Evaluating LLM Safety in Real-World Financial Scenarios** | |
| This leaderboard tracks the safety of LLMs against jailbreak attacks (e.g., PAIR, ReNeLLM, FlipAttack) in financial scenarios. | |
| Scores indicate the **Attack Success Rate (ASR, %)**. | |
| π’ **Lower is better**, meaning the model is more robust and secure against malicious financial prompts. | |
| """ | |
| ) | |
| with gr.Row(): | |
| gr.Markdown("[π Read Paper](#) | [π» GitHub Repo](https://github.com/sustech-nlp/FinSafetyBench)") | |
| gr.Markdown("### π Main Results") | |
| leaderboard_table = gr.Dataframe( | |
| value=load_data(), | |
| headers=["Model", "Crime (En)", "Crime (Zh)", "Ethical (En)", "Ethical (Zh)", "Overall Avg ASR"], | |
| datatype=["str", "number", "number", "number", "number", "number"], | |
| interactive=False, | |
| wrap=True | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() |