Spaces:
Sleeping
Sleeping
Petr Tsvetkov
commited on
Commit
·
7fbd3e2
1
Parent(s):
1f691bd
Add sample loaded and sample submitted timestamps
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import os
|
| 2 |
import random
|
| 3 |
import uuid
|
|
@@ -64,7 +65,8 @@ def update_commit_view(sample_ind):
|
|
| 64 |
commit_msg = record['message']
|
| 65 |
repo_val = record['repo']
|
| 66 |
hash_val = record['hash']
|
| 67 |
-
|
|
|
|
| 68 |
|
| 69 |
|
| 70 |
def next_sample(current_sample_ind, shuffled_idx):
|
|
@@ -125,24 +127,35 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 125 |
session_val = gr.Textbox(info='Session', interactive=False, container=True, show_label=False,
|
| 126 |
label='session')
|
| 127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
commit_view = [
|
| 129 |
github_link,
|
| 130 |
diff_view,
|
| 131 |
commit_msg,
|
| 132 |
repo_val,
|
| 133 |
-
hash_val
|
|
|
|
| 134 |
]
|
| 135 |
|
| 136 |
feedback_form = [
|
| 137 |
session_val,
|
| 138 |
repo_val,
|
| 139 |
hash_val,
|
|
|
|
|
|
|
| 140 |
verbosity_feedback,
|
| 141 |
correctness_feedback,
|
| 142 |
format_feedback
|
| 143 |
]
|
| 144 |
|
| 145 |
-
saver.setup([current_sample_sld] + feedback_form, "feedback")
|
| 146 |
|
| 147 |
skip_btn.click(next_sample, inputs=[current_sample_sld, shuffled_idx_val],
|
| 148 |
outputs=[current_sample_sld] + commit_view)
|
|
|
|
| 1 |
+
from datetime import datetime
|
| 2 |
import os
|
| 3 |
import random
|
| 4 |
import uuid
|
|
|
|
| 65 |
commit_msg = record['message']
|
| 66 |
repo_val = record['repo']
|
| 67 |
hash_val = record['hash']
|
| 68 |
+
diff_loaded_timestamp = datetime.now().isoformat()
|
| 69 |
+
return github_link_md, diff_view, commit_msg, repo_val, hash_val, diff_loaded_timestamp
|
| 70 |
|
| 71 |
|
| 72 |
def next_sample(current_sample_ind, shuffled_idx):
|
|
|
|
| 127 |
session_val = gr.Textbox(info='Session', interactive=False, container=True, show_label=False,
|
| 128 |
label='session')
|
| 129 |
|
| 130 |
+
with gr.Row(visible=False):
|
| 131 |
+
sample_loaded_timestamp = gr.Textbox(info="Sample loaded", label='loaded_ts', interactive=False,
|
| 132 |
+
container=True, show_label=False)
|
| 133 |
+
sample_submitted_timestamp = gr.Textbox(info="Current time",
|
| 134 |
+
interactive=False, container=True, show_label=False,
|
| 135 |
+
value=lambda: datetime.now().isoformat(), every=1.0,
|
| 136 |
+
label='submitted_ts')
|
| 137 |
+
|
| 138 |
commit_view = [
|
| 139 |
github_link,
|
| 140 |
diff_view,
|
| 141 |
commit_msg,
|
| 142 |
repo_val,
|
| 143 |
+
hash_val,
|
| 144 |
+
sample_loaded_timestamp
|
| 145 |
]
|
| 146 |
|
| 147 |
feedback_form = [
|
| 148 |
session_val,
|
| 149 |
repo_val,
|
| 150 |
hash_val,
|
| 151 |
+
sample_loaded_timestamp,
|
| 152 |
+
sample_submitted_timestamp,
|
| 153 |
verbosity_feedback,
|
| 154 |
correctness_feedback,
|
| 155 |
format_feedback
|
| 156 |
]
|
| 157 |
|
| 158 |
+
saver.setup([current_sample_sld] + feedback_form + [], "feedback")
|
| 159 |
|
| 160 |
skip_btn.click(next_sample, inputs=[current_sample_sld, shuffled_idx_val],
|
| 161 |
outputs=[current_sample_sld] + commit_view)
|