Skip to content

Instantly share code, notes, and snippets.

@invokesus
Created November 18, 2018 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invokesus/ae239d6e6e57551d1f0b789e7030984d to your computer and use it in GitHub Desktop.
Save invokesus/ae239d6e6e57551d1f0b789e7030984d to your computer and use it in GitHub Desktop.
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