728x90
반응형
다음과 같이 설치된 모델을 확인합니다.
llama3를 사용하려고 합니다.
코드에서 'model'에는 list에 나와있는 'NAME'을 사용합니다.
import ollama
def chat_with_ollama(model="llama3:latest", base_url="http://localhost:11434"):
client = ollama.Client()
while True:
user_input = input("사용자: ")
if user_input.lower() == "종료":
break
messages = [{"role": "user", "content": user_input}]
response = client.chat(model=model, messages=messages)
print("Ollama:", response['message']['content'])
if __name__ == "__main__":
chat_with_ollama()
728x90
반응형
'프로그램' 카테고리의 다른 글
[A.I] OpenManus(chatGPT) 사용하기 (2) | 2025.04.13 |
---|---|
[딥러닝] 지도학습 후 강화학습 (DeepSeek 알고리즘) (0) | 2025.02.04 |
[파이썬] 유튜브 자막 가져오기 (5) | 2024.10.24 |
[파이썬] png 파일로 동영상 만들기 (0) | 2024.10.15 |
[파이썬] 문제 : 데이터에서 특정 데이터가 있으면 변경하기 (0) | 2024.07.31 |
댓글