INNER CODE UNIT · Python
bot_streaming_I2T
FoundationVision/Liquid · evaluation/app.py:111
def bot_streaming_I2T(message, history):
print(message)
global stop_flag
stop_flag = True
time.sleep(0.2)
stop_flag = False
torch.cuda.empty_cache()
if message["files"]:
# message["files"][-1] is a Dict or just a string
if type(message["files"][-1]) == dict:
image = message["files"][-1]["path"]
else:
image = message["files"][-1]
else:
# if there's no image uploaded for this turn, look for images in the past turns
# kept inside tuples, take the last one
for hist in history:
if type(hist[0]) == tuple: