140 idle, winw, winh = helper.startFrame()
143 x, y, w, h = helper.drawInputFrame(
"c", inframe,
False,
False)
144 helper.itext(
'JeVois-Pro large language model (LLM) chat')
150 loop = asyncio.get_event_loop()
153 if hasattr(self,
'generator'):
157 loop.run_until_complete(asyncio.wait_for(asyncio.shield(self.
task), timeout = 0.025))
174 if user_input := self.
chatbox.get():
176 if '/videoframe/' in user_input:
177 img = inframe.getCvBGRp()
178 cv2.imwrite(
'/tmp/pyllm.jpg', img)
179 user_input = user_input.replace(
'/videoframe/',
'')
180 if len(user_input) == 0: user_input =
'Describe this image:'
181 self.
messages.append({
'role':
'user',
'content': user_input,
'images': [
'/tmp/pyllm.jpg']})
183 self.
messages.append({
'role':
'user',
'content': user_input})
186 self.
currmsg = {
'role':
'assistant',
'content':
''}
192 messages = self.
messages, stream =
True)
194 except Exception
as e:
195 helper.reportError(str(e))
199 if jevois.frameNum() % 15 == 0:
201 with open(
"/sys/class/thermal/thermal_zone1/temp",
"r")
as f:
202 temp = float(int(f.readline()) / 100) / 10
204 with open(
"/sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq")
as f:
205 freq = int(int(f.readline()) / 1000)
206 self.
statusmsg=
"{}% CPU, {}% RAM, {}C, {} MHz".format(psutil.cpu_percent(), psutil.virtual_memory().percent,
208 helper.iinfo(inframe, self.
statusmsg, winw, winh);