File size: 576 Bytes
3a29174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from llama_cpp import Llama

llm = Llama(
    model_path="deepseek-coder-6.7b.Q4_K_M.gguf",
    n_ctx=2048,
    n_threads=4
)

def chat(prompt):
    system_prompt = "You are a helpful coding assistant. Answer precisely."
    full_prompt = f"### Instruction:\n{prompt}\n### Response:\n"
    output = llm(full_prompt, max_tokens=1024)
    return output["choices"][0]["text"]

gr.Interface(
    fn=chat,
    inputs="text",
    outputs="text",
    title="DeepSeek Coder 6.7B",
    description="Free ChatGPT-style coding assistant",
    theme="soft"
).launch()