Cigolitna123 commited on
Commit
a94570a
·
2 Parent(s): a5cc344 8b4066e

Merge branch 'main' of https://huggingface.co/spaces/cigol123/mkllm-chat

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from llama_cpp import Llama
3
+
4
+ llm = Llama(
5
+ model_path="MKLLM-7B-Instruct-Q4_0.gguf",
6
+ n_ctx=2048
7
+ )
8
+
9
+ def chat(message, history):
10
+ response = llm.create_completion(
11
+ f"USER: {message}\nASSISTANT:",
12
+ max_tokens=512,
13
+ temperature=0.7
14
+ )
15
+ return response['choices'][0]['text']
16
+
17
+ demo = gr.ChatInterface(
18
+ chat,
19
+ title="MKLLM Chat",
20
+ )
21
+
22
+ demo.launch()