This commit is contained in:
yumoqing 2025-05-23 06:51:08 +00:00
parent fcf7d7c0d4
commit bb9cd90831
2 changed files with 9 additions and 3 deletions

View File

@ -87,15 +87,20 @@ class FastVLM:
'timecost': t2 - t1, 'timecost': t2 - t1,
'content': outputs 'content': outputs
} }
debug(f'Exception happened .......')
return None
async def generate(self, image_file, prompt): async def generate(self, image_file, prompt):
f = awaitify(self._generate) f = awaitify(self._generate)
return await f(image_file, promot) return await f(image_file, prompt)
fastvlm = None
def init(): def init():
global fastvlm
g = ServerEnv() g = ServerEnv()
k = FastVLM() g.fastvlm = fastvlm
g.generate = k.generate fastvlm = FastVLM()
g.generate = fastvlm.generate
if __name__ == "__main__": if __name__ == "__main__":
webapp(init) webapp(init)

View File

@ -3,5 +3,6 @@ image_path = realpath(params_kw.image_path)
prompt = params_kw.prompt prompt = params_kw.prompt
debug(f'{image_path=}, {prompt=}') debug(f'{image_path=}, {prompt=}')
d = await generate(image_path, prompt) d = await generate(image_path, prompt)
debug(f'{image_path=}, {prompt=}, {d=}')
return d return d