Fix: modified to add submission form
Browse files
app.py
CHANGED
|
@@ -1,14 +1,35 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
-
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
gr.Markdown("# 📊 Model Leaderboard")
|
| 12 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
+
CSV_PATH = "results.csv"
|
| 5 |
|
| 6 |
+
# 기존 데이터 불러오기
|
| 7 |
+
df = pd.read_csv(CSV_PATH)
|
| 8 |
+
|
| 9 |
+
def submit(model, acc, f1, time, link):
|
| 10 |
+
new_row = {
|
| 11 |
+
"Model Name": model,
|
| 12 |
+
"Accuracy": float(acc),
|
| 13 |
+
"F1 Score": float(f1),
|
| 14 |
+
"Inference Time (s)": float(time),
|
| 15 |
+
"Hugging Face Link": link
|
| 16 |
+
}
|
| 17 |
+
# 기존 + 새로운 데이터
|
| 18 |
+
updated = pd.concat([df, pd.DataFrame([new_row])], ignore_index=True)
|
| 19 |
+
updated.to_csv(CSV_PATH, index=False)
|
| 20 |
+
return updated
|
| 21 |
|
| 22 |
with gr.Blocks() as demo:
|
| 23 |
gr.Markdown("# 📊 Model Leaderboard")
|
| 24 |
+
with gr.Row():
|
| 25 |
+
model = gr.Textbox(label="Model Name")
|
| 26 |
+
acc = gr.Textbox(label="Accuracy")
|
| 27 |
+
f1 = gr.Textbox(label="F1 Score")
|
| 28 |
+
time = gr.Textbox(label="Inference Time (s)")
|
| 29 |
+
link = gr.Textbox(label="Hugging Face Link")
|
| 30 |
+
submit_btn = gr.Button("Submit Result")
|
| 31 |
+
output_df = gr.Dataframe(value=df, headers=list(df.columns), interactive=False)
|
| 32 |
+
|
| 33 |
+
submit_btn.click(fn=submit, inputs=[model, acc, f1, time, link], outputs=output_df)
|
| 34 |
|
| 35 |
demo.launch()
|