Created
November 18, 2018 18:19
-
-
Save invokesus/ae239d6e6e57551d1f0b789e7030984d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
objects = ["person", "ball", "bottle", "book"] | |
import time | |
current_index = 0 | |
def write_to_file(obj_name): | |
time.sleep(1) | |
with open('./label.txt', 'w') as f: | |
f.write(obj_name) | |
while True: | |
a = str(input()) | |
if a == r'': | |
try: | |
write_to_file(objects[current_index]) | |
current_index+=1 | |
except: | |
print("use manual") | |
elif a == 'p': | |
write_to_file("person") | |
elif a == 'a': | |
write_to_file("ball") | |
elif a == 'b': | |
write_to_file("bottle") | |
elif a == 'c': | |
write_to_file("book") | |
elif a == 'm': | |
write_to_file("cell phone") | |
elif a == 'w': | |
write_to_file("pen") | |
else: | |
write_to_file(a) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment