misukisu commited on
Commit
2813c21
·
verified ·
1 Parent(s): d7e2b4a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from llama_cpp import Llama
3
+
4
+ llm = Llama(
5
+ model_path="gemma-4-E4B-it-Q4_K_M.gguf", # polku malliin
6
+ n_ctx=8192,
7
+ n_threads=2, # sun 2 vCPU
8
+ n_gpu_layers=0 # CPU only
9
+ )
10
+
11
+ def chat(message, history):
12
+ response = llm.create_chat_completion(
13
+ messages=[{"role": "user", "content": message}]
14
+ )
15
+ return response['choices'][0]['message']['content']
16
+
17
+ gr.ChatInterface(chat).launch()