zhongqiyi/main.py

40 lines
986 B
Python

from ollama import Client
def get_completion(prompt, model="solar"):
client = Client(host='http://8.130.118.164:11434/')
response = client.chat(model, messages=[
{
'role': 'user',
'content': prompt,
},
])
print(response)
print(response['message'])
return response['message']['content']
print(get_completion("你好,我是小明。"))
# import cv2
# def test_camera():
# video_capture = cv2.VideoCapture(0) # 打开默认摄像头
#
# if not video_capture.isOpened():
# print("无法打开摄像头")
# return
#
# while True:
# ret, frame = video_capture.read()
# if not ret:
# print("无法读取摄像头画面")
# break
#
# cv2.imshow('Video', frame)
#
# if cv2.waitKey(1) & 0xFF == ord('q'): # 按 'q' 键退出
# break
#
# video_capture.release()
# cv2.destroyAllWindows()
#
# # 调用函数
# test_camera()