137 idle, winw, winh = helper.startFrame()
140 x, y, w, h = helper.drawInputFrame(
"c", inframe,
False,
False)
141 helper.itext(
'JeVois-Pro large language model (LLM) chat')
147 loop = asyncio.get_event_loop()
150 if hasattr(self,
'generator'):
154 loop.run_until_complete(asyncio.wait_for(asyncio.shield(self.
task), timeout = 0.025))
166 if user_input := self.
chatbox.get():
168 if '/videoframe/' in user_input:
169 img = inframe.getCvBGRp()
170 cv2.imwrite(
'/tmp/pyllm.jpg', img)
171 user_input = user_input.replace(
'/videoframe/',
'')
172 if len(user_input) == 0: user_input =
'Describe this image:'
173 self.
messages.append({
'role':
'user',
'content': user_input,
'images': [
'/tmp/pyllm.jpg']})
175 self.
messages.append({
'role':
'user',
'content': user_input})
178 self.
currmsg = {
'role':
'assistant',
'content':
''}
187 if jevois.frameNum() % 15 == 0:
189 with open(
"/sys/class/thermal/thermal_zone1/temp",
"r")
as f:
190 temp = float(int(f.readline()) / 100) / 10
192 with open(
"/sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq")
as f:
193 freq = int(int(f.readline()) / 1000)
194 self.
statusmsg=
"{}% CPU, {}% RAM, {}C, {} MHz".format(psutil.cpu_percent(), psutil.virtual_memory().percent,
196 helper.iinfo(inframe, self.
statusmsg, winw, winh);