MuhammadHamza33 commited on
Commit
d25852b
·
1 Parent(s): 205d8b1
Files changed (3) hide show
  1. .gguf +1 -0
  2. app.py +31 -0
  3. requirements.txt +2 -0
.gguf ADDED
@@ -0,0 +1 @@
 
 
1
+ finance-chat.Q2_K.gguf
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from llama_cpp import Llama
3
+
4
+ # Path to your Q2 model inside the Space
5
+ MODEL_PATH = "finance-chat.Q2_K.gguf"
6
+
7
+ # Load the model with llama.cpp
8
+ llm = Llama(
9
+ model_path=MODEL_PATH,
10
+ n_threads=2, # Free HF CPU = ~2 threads
11
+ n_ctx=4096,
12
+ verbose=False
13
+ )
14
+
15
+ def generate(prompt):
16
+ output = llm(
17
+ prompt,
18
+ max_tokens=256,
19
+ temperature=0.7,
20
+ top_p=0.9
21
+ )
22
+ return output["choices"][0]["text"].strip()
23
+
24
+ demo = gr.Interface(
25
+ fn=generate,
26
+ inputs="text",
27
+ outputs="text",
28
+ title="Finance Chat LLM (GGUF Q2_K - Free Space)"
29
+ )
30
+
31
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ llama-cpp-python==0.2.80
2
+ gradio