File size: 482 Bytes
45715c2
5d354bb
 
 
 
 
7f05c49
5d09706
5d354bb
 
45715c2
 
5d354bb
 
 
 
 
45715c2
5d354bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from llama_cpp import Llama

llm = Llama.from_pretrained(
    repo_id="HackNetAyush/smollm2-135M-instruct-gguf-q8",
    filename="smollm2-135m-instruct-q8_0.gguf",
    n_ctx=8192,
    n_batch=1024,
    n_threads=2,
    verbose=False,
)

def chat(message, history):
    response = llm.create_chat_completion(
        messages=[{"role": "user", "content": message}]
    )
    return response["choices"][0]["message"]["content"]

gr.ChatInterface(fn=chat).launch()