Petr Tsvetkov commited on
Commit ·
b2f40c2
1
Parent(s): e765db8
Use local timestamp instead of gradio-updated one to increase the keylogging precision
Browse files185 unmodified lines186187188189190191192193194195196197198199200201202185 unmodified lines)def on_commit_msg_changed(message, prev_message, history, timestamp):for i, s in enumerate(ndiff(prev_message, message)):diff = char_diff_obj(s[0], i, s[-1], timestamp)if diff['type'] in ('+', '-'):print(diff)history.append(diff)return message, historycommit_msg.change(on_commit_msg_changed, inputs=[commit_msg, commit_msg_prev, commit_msg_history,now_timestamp],outputs=[commit_msg_prev, commit_msg_history])185 unmodified lines186187188189190191192193194195196197198199200201185 unmodified lines)def on_commit_msg_changed(message, prev_message, history):timestamp = datetime.now().isoformat()for i, s in enumerate(ndiff(prev_message, message)):diff = char_diff_obj(s[0], i, s[-1], timestamp)if diff['type'] in ('+', '-'):history.append(diff)return message, historycommit_msg.change(on_commit_msg_changed, inputs=[commit_msg, commit_msg_prev, commit_msg_history],outputs=[commit_msg_prev, commit_msg_history])
app.py+3-4