File size: 564 Bytes
54a235d 8396f74 54a235d 81c4f13 7d9b74c 54a235d 8396f74 81c4f13 bfa18a9 81c4f13 bfa18a9 7d9b74c 54a235d 8396f74 81c4f13 bfa18a9 81c4f13 bfa18a9 7d9b74c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import os
import spaces
from src.modules.models.model_loader import model_loader as ModelLoader
from src.storage.state import state as State
@spaces.GPU(duration=10)
def image_describe(image_path):
State.begin()
result = ModelLoader.image_describe(image_path)
State.end()
return result
@spaces.GPU(duration=10)
def image_test(image_path, questions):
State.begin()
result = []
for question in questions:
out = ModelLoader.image_ask(image_path, question)
result.append(out == 'Yes')
State.end()
return result
|