Petr Tsvetkov
commited on
Commit
β’
b6ae739
1
Parent(s):
c151bb0
Fix the dfs in visualization
Browse files- change_visualizer.py +17 -9
change_visualizer.py
CHANGED
@@ -13,12 +13,20 @@ STATISTICS = {"manual": statistics.get_statistics_for_df(df_manual),
|
|
13 |
"synthetic": statistics.get_statistics_for_df(df_synthetic)}
|
14 |
|
15 |
|
16 |
-
def update_dataset_view(diff_idx):
|
17 |
diff_idx -= 1
|
18 |
-
return
|
19 |
-
|
20 |
-
'commit_msg_end'],
|
21 |
-
'session'], f"https://github.com/{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
force_light_theme_js_func = """
|
@@ -58,13 +66,13 @@ if __name__ == '__main__':
|
|
58 |
with gr.Tab("Manual"):
|
59 |
slider_manual, view_manual = dataset_view_tab(n_diffs_manual)
|
60 |
|
61 |
-
slider_manual.change(
|
62 |
outputs=view_manual)
|
63 |
|
64 |
with gr.Tab("Synthetic"):
|
65 |
slider_synthetic, view_synthetic = dataset_view_tab(n_diffs_synthetic)
|
66 |
|
67 |
-
slider_synthetic.change(
|
68 |
outputs=view_synthetic)
|
69 |
with gr.Tab("Compare"):
|
70 |
def layout_for_statistics(statistics_group_name):
|
@@ -85,10 +93,10 @@ if __name__ == '__main__':
|
|
85 |
with gr.Column(scale=1):
|
86 |
layout_for_statistics("synthetic")
|
87 |
|
88 |
-
application.load(
|
89 |
outputs=view_manual)
|
90 |
|
91 |
-
application.load(
|
92 |
outputs=view_synthetic)
|
93 |
|
94 |
application.launch()
|
|
|
13 |
"synthetic": statistics.get_statistics_for_df(df_synthetic)}
|
14 |
|
15 |
|
16 |
+
def update_dataset_view(diff_idx, df):
|
17 |
diff_idx -= 1
|
18 |
+
return df.iloc[diff_idx]['annotated_diff'], df.iloc[diff_idx]['commit_msg_start'], \
|
19 |
+
df.iloc[diff_idx][
|
20 |
+
'commit_msg_end'], df.iloc[diff_idx][
|
21 |
+
'session'], f"https://github.com/{df.iloc[diff_idx]['repo']}/commit/{df.iloc[diff_idx]['hash']}"
|
22 |
+
|
23 |
+
|
24 |
+
def update_dataset_view_manual(diff_idx):
|
25 |
+
update_dataset_view(diff_idx, df_manual)
|
26 |
+
|
27 |
+
|
28 |
+
def update_dataset_view_synthetic(diff_idx):
|
29 |
+
update_dataset_view(diff_idx, df_synthetic)
|
30 |
|
31 |
|
32 |
force_light_theme_js_func = """
|
|
|
66 |
with gr.Tab("Manual"):
|
67 |
slider_manual, view_manual = dataset_view_tab(n_diffs_manual)
|
68 |
|
69 |
+
slider_manual.change(update_dataset_view_manual, inputs=slider_manual,
|
70 |
outputs=view_manual)
|
71 |
|
72 |
with gr.Tab("Synthetic"):
|
73 |
slider_synthetic, view_synthetic = dataset_view_tab(n_diffs_synthetic)
|
74 |
|
75 |
+
slider_synthetic.change(update_dataset_view_synthetic, inputs=slider_synthetic,
|
76 |
outputs=view_synthetic)
|
77 |
with gr.Tab("Compare"):
|
78 |
def layout_for_statistics(statistics_group_name):
|
|
|
93 |
with gr.Column(scale=1):
|
94 |
layout_for_statistics("synthetic")
|
95 |
|
96 |
+
application.load(update_dataset_view_manual, inputs=slider_manual,
|
97 |
outputs=view_manual)
|
98 |
|
99 |
+
application.load(update_dataset_view_synthetic, inputs=slider_synthetic,
|
100 |
outputs=view_synthetic)
|
101 |
|
102 |
application.launch()
|