import subprocess

import requests

import time

import os


llama_server = os.path.join(os.getcwd(), "llama-server.exe")

model = os.path.join(os.getcwd(), "tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf")


print("Starting AI brain...")

server = subprocess.Popen([

    llama_server,

    "-m", model,

    "--port", "8080",

    "-c", "2048"

])


time.sleep(10)


response = requests.post("http://localhost:8080/completion", json={

    "prompt": "User: Hello, how are you?\nAssistant:",

    "max_tokens": 100

})


print("AI said:", response.json()["content"])

server.terminate()

Comments

Popular posts from this blog