Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app/ui_battle.py
Browse files- app/ui_battle.py +26 -26
app/ui_battle.py
CHANGED
@@ -59,31 +59,31 @@ with gr.Blocks() as battle:
|
|
59 |
nxt_outputs = [abetter, bbetter, prevmodel1, prevmodel2]
|
60 |
abetter.click(a_is_better_battle, outputs=nxt_outputs, inputs=[model1, model2, battle_useridstate])
|
61 |
bbetter.click(b_is_better_battle, outputs=nxt_outputs, inputs=[model1, model2, battle_useridstate])
|
62 |
-
battle.load(random_m, outputs=[model1s, model2s], js="""function() {
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
}""")
|
|
|
59 |
nxt_outputs = [abetter, bbetter, prevmodel1, prevmodel2]
|
60 |
abetter.click(a_is_better_battle, outputs=nxt_outputs, inputs=[model1, model2, battle_useridstate])
|
61 |
bbetter.click(b_is_better_battle, outputs=nxt_outputs, inputs=[model1, model2, battle_useridstate])
|
62 |
+
# battle.load(random_m, outputs=[model1s, model2s], js="""function() {
|
63 |
+
# document.addEventListener('keydown', function(e) {
|
64 |
+
# // Only handle shortcuts if we're on the battle tab
|
65 |
+
# if (!document.querySelector('#battle-a-button')?.offsetParent) {
|
66 |
+
# // Check if random button is visible
|
67 |
+
# if (document.querySelector('#battle-random-button')?.offsetParent) {
|
68 |
+
# if (e.key === 'r') {
|
69 |
+
# document.getElementById('battle-random-button')?.click();
|
70 |
+
# } else if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
|
71 |
+
# document.getElementById('battle-synth-button')?.click();
|
72 |
+
# }
|
73 |
+
# }
|
74 |
+
# return;
|
75 |
+
# }
|
76 |
|
77 |
+
# // Only handle A and B keys when not typing in an input
|
78 |
+
# if (document.activeElement.tagName === 'INPUT' ||
|
79 |
+
# document.activeElement.tagName === 'TEXTAREA') {
|
80 |
+
# return;
|
81 |
+
# }
|
82 |
|
83 |
+
# if (e.key.toLowerCase() === 'a') {
|
84 |
+
# document.getElementById('battle-a-button')?.click();
|
85 |
+
# } else if (e.key.toLowerCase() === 'b') {
|
86 |
+
# document.getElementById('battle-b-button')?.click();
|
87 |
+
# }
|
88 |
+
# });
|
89 |
+
# }""")
|