Petr Tsvetkov
commited on
Commit
•
b2f40c2
1
Parent(s):
e765db8
Use local timestamp instead of gradio-updated one to increase the keylogging precision
Browse files
app.py
CHANGED
@@ -186,17 +186,16 @@ with gr.Blocks(theme=gr.themes.Soft(), head=head_html, css="style_overrides.css"
|
|
186 |
)
|
187 |
|
188 |
|
189 |
-
def on_commit_msg_changed(message, prev_message, history
|
|
|
190 |
for i, s in enumerate(ndiff(prev_message, message)):
|
191 |
diff = char_diff_obj(s[0], i, s[-1], timestamp)
|
192 |
if diff['type'] in ('+', '-'):
|
193 |
-
print(diff)
|
194 |
history.append(diff)
|
195 |
return message, history
|
196 |
|
197 |
|
198 |
-
commit_msg.change(on_commit_msg_changed, inputs=[commit_msg, commit_msg_prev, commit_msg_history,
|
199 |
-
now_timestamp],
|
200 |
outputs=[commit_msg_prev, commit_msg_history])
|
201 |
|
202 |
|
|
|
186 |
)
|
187 |
|
188 |
|
189 |
+
def on_commit_msg_changed(message, prev_message, history):
|
190 |
+
timestamp = datetime.now().isoformat()
|
191 |
for i, s in enumerate(ndiff(prev_message, message)):
|
192 |
diff = char_diff_obj(s[0], i, s[-1], timestamp)
|
193 |
if diff['type'] in ('+', '-'):
|
|
|
194 |
history.append(diff)
|
195 |
return message, history
|
196 |
|
197 |
|
198 |
+
commit_msg.change(on_commit_msg_changed, inputs=[commit_msg, commit_msg_prev, commit_msg_history],
|
|
|
199 |
outputs=[commit_msg_prev, commit_msg_history])
|
200 |
|
201 |
|