Spaces:
Runtime error
Runtime error
Commit
·
64218fa
1
Parent(s):
b4595f3
app.py
CHANGED
|
@@ -319,14 +319,18 @@ def next_image(calibrate_prompts, user_id):
|
|
| 319 |
|
| 320 |
|
| 321 |
|
|
|
|
| 322 |
is_started = False
|
| 323 |
|
| 324 |
def start(_, calibrate_prompts, user_id, request: gr.Request):
|
| 325 |
global is_started
|
|
|
|
| 326 |
user_id = int(str(time.time())[-7:].replace('.', ''))
|
| 327 |
image, calibrate_prompts = next_image(calibrate_prompts, user_id)
|
| 328 |
if not is_started:
|
| 329 |
-
|
|
|
|
|
|
|
| 330 |
return [
|
| 331 |
gr.Button(value='Like (L)', interactive=True),
|
| 332 |
gr.Button(value='Neither (Space)', interactive=True, visible=False),
|
|
@@ -488,8 +492,6 @@ log.setLevel(logging.ERROR)
|
|
| 488 |
#scheduler.add_job(func=background_next_image, trigger="interval", seconds=.1)
|
| 489 |
#scheduler.start()
|
| 490 |
|
| 491 |
-
#thread = threading.Thread(target=background_next_image,)
|
| 492 |
-
#thread.start()
|
| 493 |
|
| 494 |
@spaces.GPU()
|
| 495 |
def encode_space(x):
|
|
|
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
+
thread = threading.Thread(target=background_next_image,)
|
| 323 |
is_started = False
|
| 324 |
|
| 325 |
def start(_, calibrate_prompts, user_id, request: gr.Request):
|
| 326 |
global is_started
|
| 327 |
+
global thread
|
| 328 |
user_id = int(str(time.time())[-7:].replace('.', ''))
|
| 329 |
image, calibrate_prompts = next_image(calibrate_prompts, user_id)
|
| 330 |
if not is_started:
|
| 331 |
+
thread.start()
|
| 332 |
+
is_started = True
|
| 333 |
+
|
| 334 |
return [
|
| 335 |
gr.Button(value='Like (L)', interactive=True),
|
| 336 |
gr.Button(value='Neither (Space)', interactive=True, visible=False),
|
|
|
|
| 492 |
#scheduler.add_job(func=background_next_image, trigger="interval", seconds=.1)
|
| 493 |
#scheduler.start()
|
| 494 |
|
|
|
|
|
|
|
| 495 |
|
| 496 |
@spaces.GPU()
|
| 497 |
def encode_space(x):
|