Spaces:
Runtime error
Runtime error
Yoon-gu Hwang commited on
Commit ยท
3bed1b1
1
Parent(s): ad8b121
make simple ux
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ with gr.Blocks() as demo:
|
|
| 5 |
dataset_df = {}
|
| 6 |
state = gr.State(value=0)
|
| 7 |
with gr.Row():
|
| 8 |
-
gr.Markdown("#
|
| 9 |
with gr.Row():
|
| 10 |
file = gr.File(label="Upload a file")
|
| 11 |
prev = gr.Button(value="Previous")
|
|
@@ -40,7 +40,6 @@ with gr.Blocks() as demo:
|
|
| 40 |
|
| 41 |
def next_func(score):
|
| 42 |
df_dict = dataset_df['df_dict']
|
| 43 |
-
df_dict[state.value]['score'] = score
|
| 44 |
state.value = min(state.value + 1, len(dataset_df['df']) - 1)
|
| 45 |
score = df_dict[state.value]['score']
|
| 46 |
gr.Info(f"์ด {len(dataset_df['df'])}๊ฐ ์ค์ {state.value + 1}๋ฒ์งธ ๋ฐ์ดํฐ์
๋๋ค.")
|
|
@@ -56,9 +55,18 @@ with gr.Blocks() as demo:
|
|
| 56 |
todos = df[df.score.isna()]
|
| 57 |
done = df[df.score.isna() == False]
|
| 58 |
return q, g, p, todos, done, "data_backup.csv"
|
|
|
|
| 59 |
file.upload(csv2df, file, [question, ground_truth, prediction, todos, done, download])
|
| 60 |
prev.click(prev_func, [score], [question, ground_truth, prediction, todos, done, download, score])
|
| 61 |
next.click(next_func, [score], [question, ground_truth, prediction, todos, done, download, score])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
demo.queue()
|
| 64 |
demo.launch()
|
|
|
|
| 5 |
dataset_df = {}
|
| 6 |
state = gr.State(value=0)
|
| 7 |
with gr.Row():
|
| 8 |
+
gr.Markdown("# Evaluation ๐")
|
| 9 |
with gr.Row():
|
| 10 |
file = gr.File(label="Upload a file")
|
| 11 |
prev = gr.Button(value="Previous")
|
|
|
|
| 40 |
|
| 41 |
def next_func(score):
|
| 42 |
df_dict = dataset_df['df_dict']
|
|
|
|
| 43 |
state.value = min(state.value + 1, len(dataset_df['df']) - 1)
|
| 44 |
score = df_dict[state.value]['score']
|
| 45 |
gr.Info(f"์ด {len(dataset_df['df'])}๊ฐ ์ค์ {state.value + 1}๋ฒ์งธ ๋ฐ์ดํฐ์
๋๋ค.")
|
|
|
|
| 55 |
todos = df[df.score.isna()]
|
| 56 |
done = df[df.score.isna() == False]
|
| 57 |
return q, g, p, todos, done, "data_backup.csv"
|
| 58 |
+
|
| 59 |
file.upload(csv2df, file, [question, ground_truth, prediction, todos, done, download])
|
| 60 |
prev.click(prev_func, [score], [question, ground_truth, prediction, todos, done, download, score])
|
| 61 |
next.click(next_func, [score], [question, ground_truth, prediction, todos, done, download, score])
|
| 62 |
+
def select_func(request: gr.Request, evt: gr.SelectData):
|
| 63 |
+
df_dict = dataset_df['df_dict']
|
| 64 |
+
df_dict[state.value]['score'] = evt.value
|
| 65 |
+
state.value = min(state.value + 1, len(dataset_df['df']) - 1)
|
| 66 |
+
score = df_dict[state.value]['score']
|
| 67 |
+
gr.Info(f"์ด {len(dataset_df['df'])}๊ฐ ์ค์ {state.value + 1}๋ฒ์งธ ๋ฐ์ดํฐ์
๋๋ค.")
|
| 68 |
+
return [*update(), score]
|
| 69 |
+
score.select(select_func, None, [question, ground_truth, prediction, todos, done, download, score])
|
| 70 |
|
| 71 |
demo.queue()
|
| 72 |
demo.launch()
|