Spaces:
Sleeping
Sleeping
quantumiracle-git
commited on
Commit
·
19e217c
1
Parent(s):
cc888d7
Update app.py
Browse files
app.py
CHANGED
@@ -166,7 +166,7 @@ def get_huggingface_dataset():
|
|
166 |
log_file = os.path.join(dataset_dir, "flag_data.csv")
|
167 |
return repo, log_file
|
168 |
|
169 |
-
def update(user_choice, left, right, choose_env, data_folder=VIDEO_PATH, flag_to_huggingface=False):
|
170 |
global last_left_video_path
|
171 |
global last_right_video_path
|
172 |
global last_infer_left_video_path
|
@@ -175,7 +175,7 @@ def update(user_choice, left, right, choose_env, data_folder=VIDEO_PATH, flag_to
|
|
175 |
if flag_to_huggingface: # log
|
176 |
env_name = str(last_left_video_path).split('/')[1] # 'robotinder-data/ENV_NAME/'
|
177 |
current_time = strftime("%Y-%m-%d-%H-%M-%S", gmtime())
|
178 |
-
info = [env_name, user_choice, last_left_video_path, last_right_video_path, current_time]
|
179 |
print(info)
|
180 |
repo, log_file = get_huggingface_dataset()
|
181 |
with open(log_file, 'a') as file: # incremental change of the file
|
@@ -327,6 +327,7 @@ def build_interface(iter=3, data_folder=VIDEO_PATH):
|
|
327 |
last_infer_right_video_path = infer_right_video_path
|
328 |
|
329 |
# btn1 = gr.Button("Replay")
|
|
|
330 |
user_choice = gr.Radio(["Left", "Right", "Not Sure", "Both Good", "Both Bad"], label="Which one is your favorite?")
|
331 |
choose_env = gr.Radio(["Random"]+ENVS, label="Choose the next task:")
|
332 |
btn2 = gr.Button("Next")
|
@@ -335,7 +336,7 @@ def build_interface(iter=3, data_folder=VIDEO_PATH):
|
|
335 |
# callback.setup([user_choice, left, right], "flagged_data_points")
|
336 |
|
337 |
# btn1.click(fn=replay, inputs=[left, right], outputs=[left, right])
|
338 |
-
btn2.click(fn=update, inputs=[user_choice, left, right, choose_env], outputs=[left, right, str_env_name])
|
339 |
|
340 |
# We can choose which components to flag -- in this case, we'll flag all of them
|
341 |
# btn2.click(lambda *args: callback.flag(args), [user_choice, left, right], None, preprocess=False) # not using the gradio flagging anymore
|
|
|
166 |
log_file = os.path.join(dataset_dir, "flag_data.csv")
|
167 |
return repo, log_file
|
168 |
|
169 |
+
def update(user_choice, user_name, left, right, choose_env, data_folder=VIDEO_PATH, flag_to_huggingface=False):
|
170 |
global last_left_video_path
|
171 |
global last_right_video_path
|
172 |
global last_infer_left_video_path
|
|
|
175 |
if flag_to_huggingface: # log
|
176 |
env_name = str(last_left_video_path).split('/')[1] # 'robotinder-data/ENV_NAME/'
|
177 |
current_time = strftime("%Y-%m-%d-%H-%M-%S", gmtime())
|
178 |
+
info = [env_name, user_choice, last_left_video_path, last_right_video_path, current_time, user_name]
|
179 |
print(info)
|
180 |
repo, log_file = get_huggingface_dataset()
|
181 |
with open(log_file, 'a') as file: # incremental change of the file
|
|
|
327 |
last_infer_right_video_path = infer_right_video_path
|
328 |
|
329 |
# btn1 = gr.Button("Replay")
|
330 |
+
user_name = gr.Textbox(label='Your name/email:')
|
331 |
user_choice = gr.Radio(["Left", "Right", "Not Sure", "Both Good", "Both Bad"], label="Which one is your favorite?")
|
332 |
choose_env = gr.Radio(["Random"]+ENVS, label="Choose the next task:")
|
333 |
btn2 = gr.Button("Next")
|
|
|
336 |
# callback.setup([user_choice, left, right], "flagged_data_points")
|
337 |
|
338 |
# btn1.click(fn=replay, inputs=[left, right], outputs=[left, right])
|
339 |
+
btn2.click(fn=update, inputs=[user_choice, user_name, left, right, choose_env], outputs=[left, right, str_env_name])
|
340 |
|
341 |
# We can choose which components to flag -- in this case, we'll flag all of them
|
342 |
# btn2.click(lambda *args: callback.flag(args), [user_choice, left, right], None, preprocess=False) # not using the gradio flagging anymore
|