Spaces:
Build error
Build error
merge conflict
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import subprocess
|
2 |
|
3 |
-
commands = 'pip uninstall gradio -y; echo "pwd is: $(pwd)"; pip install ./gradio-12.34.56.tar.gz'
|
4 |
-
subprocess.run(commands, shell=True)
|
5 |
|
6 |
import json
|
7 |
import os
|
@@ -9,8 +9,6 @@ import os
|
|
9 |
import shutil
|
10 |
import threading
|
11 |
|
12 |
-
from typing import List
|
13 |
-
|
14 |
import gradio as gr
|
15 |
|
16 |
from dialogues import DialogueTemplate
|
@@ -41,6 +39,13 @@ STYLE = """
|
|
41 |
box-shadow: 0 0 15px 0.5px #E1BEE7 !important;
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
// "done" class is injected when user has made
|
45 |
// decision between two candidate generated answers
|
46 |
.message.bot.done {
|
@@ -56,13 +61,6 @@ STYLE = """
|
|
56 |
background-color: var(--background-fill-secondary);
|
57 |
}
|
58 |
}
|
59 |
-
|
60 |
-
.button:active {
|
61 |
-
color: black;
|
62 |
-
border: none;
|
63 |
-
background-color: #CE93D8 !important;
|
64 |
-
box-shadow: 0 0 15px 0.5px #F3E5F5 !important;
|
65 |
-
}
|
66 |
"""
|
67 |
|
68 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
@@ -86,13 +84,13 @@ if HF_TOKEN:
|
|
86 |
pass
|
87 |
|
88 |
print("Pulling repo...")
|
89 |
-
repo = Repository(
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
)
|
95 |
-
repo.git_pull()
|
96 |
|
97 |
system_message = ""
|
98 |
|
@@ -177,7 +175,7 @@ def on_select(event: gr.SelectData, history):
|
|
177 |
threading.Thread(target=save_labeling_data, args=(history[-1], score)).start()
|
178 |
|
179 |
del history[-1][index_to_delete]
|
180 |
-
return history
|
181 |
|
182 |
|
183 |
with gr.Blocks(css=STYLE) as demo:
|
@@ -191,26 +189,27 @@ with gr.Blocks(css=STYLE) as demo:
|
|
191 |
[user_message, chatbot],
|
192 |
queue=False,
|
193 |
).then(
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
197 |
let last_elem = document.querySelector("div.message.bot.done");
|
198 |
last_elem.classList.remove("done");
|
199 |
}
|
200 |
-
"""
|
201 |
)
|
202 |
|
203 |
-
chatbot.select(
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
|
209 |
let last_elem = document.querySelector("div.message.bot.latest");
|
210 |
last_elem.classList.remove("latest");
|
211 |
last_elem.classList.add("done");
|
212 |
}
|
213 |
-
"""
|
214 |
)
|
215 |
|
216 |
clear.click(lambda: None, None, chatbot, queue=False)
|
|
|
1 |
import subprocess
|
2 |
|
3 |
+
# commands = 'pip uninstall gradio -y; echo "pwd is: $(pwd)"; pip install ./gradio-12.34.56.tar.gz'
|
4 |
+
# subprocess.run(commands, shell=True)
|
5 |
|
6 |
import json
|
7 |
import os
|
|
|
9 |
import shutil
|
10 |
import threading
|
11 |
|
|
|
|
|
12 |
import gradio as gr
|
13 |
|
14 |
from dialogues import DialogueTemplate
|
|
|
39 |
box-shadow: 0 0 15px 0.5px #E1BEE7 !important;
|
40 |
}
|
41 |
|
42 |
+
.button:active {
|
43 |
+
color: black;
|
44 |
+
border: none;
|
45 |
+
background-color: #CE93D8 !important;
|
46 |
+
box-shadow: 0 0 15px 0.5px #F3E5F5 !important;
|
47 |
+
}
|
48 |
+
|
49 |
// "done" class is injected when user has made
|
50 |
// decision between two candidate generated answers
|
51 |
.message.bot.done {
|
|
|
61 |
background-color: var(--background-fill-secondary);
|
62 |
}
|
63 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
"""
|
65 |
|
66 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
|
|
84 |
pass
|
85 |
|
86 |
print("Pulling repo...")
|
87 |
+
# repo = Repository(
|
88 |
+
# local_dir="./data/",
|
89 |
+
# clone_from=REPO_ID,
|
90 |
+
# use_auth_token=HF_TOKEN,
|
91 |
+
# repo_type="dataset",
|
92 |
+
# )
|
93 |
+
# repo.git_pull()
|
94 |
|
95 |
system_message = ""
|
96 |
|
|
|
175 |
threading.Thread(target=save_labeling_data, args=(history[-1], score)).start()
|
176 |
|
177 |
del history[-1][index_to_delete]
|
178 |
+
return (gr.update(interactive=True), history)
|
179 |
|
180 |
|
181 |
with gr.Blocks(css=STYLE) as demo:
|
|
|
189 |
[user_message, chatbot],
|
190 |
queue=False,
|
191 |
).then(
|
192 |
+
None,
|
193 |
+
None,
|
194 |
+
None,
|
195 |
+
_js="""()=>{
|
196 |
let last_elem = document.querySelector("div.message.bot.done");
|
197 |
last_elem.classList.remove("done");
|
198 |
}
|
199 |
+
""",
|
200 |
)
|
201 |
|
202 |
+
chatbot.select(on_select, chatbot, chatbot).then(
|
203 |
+
None,
|
204 |
+
None,
|
205 |
+
None,
|
206 |
+
_js="""()=>{
|
207 |
|
208 |
let last_elem = document.querySelector("div.message.bot.latest");
|
209 |
last_elem.classList.remove("latest");
|
210 |
last_elem.classList.add("done");
|
211 |
}
|
212 |
+
""",
|
213 |
)
|
214 |
|
215 |
clear.click(lambda: None, None, chatbot, queue=False)
|