Goated121 commited on
Commit
88b5c49
·
verified ·
1 Parent(s): 872e4c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -1,12 +1,17 @@
 
1
  import gradio as gr
2
- from llama_cpp import Llama # if using llama.cpp via GGUF
3
 
4
- # Load quantized model
5
- model = Llama(model_path="qwen2.5-1.5B-q4.gguf")
6
 
7
- def generate(prompt):
8
- output = model(prompt, max_tokens=100)
9
- return output['text']
 
 
 
 
 
 
10
 
11
- demo = gr.Interface(fn=generate, inputs="text", outputs="text")
12
  demo.launch()
 
1
+ from llama_cpp import Llama
2
  import gradio as gr
 
3
 
4
+ # Load your quantized GGUF model
5
+ llm = Llama(model_path="/app/models/qwen2.5-1.5B-q4.gguf")
6
 
7
+ def generate_text(prompt):
8
+ output = llm(prompt, max_tokens=200)
9
+ return output['choices'][0]['text']
10
+
11
+ demo = gr.Interface(
12
+ fn=generate_text,
13
+ inputs=gr.Textbox(lines=2, placeholder="Type your prompt here..."),
14
+ outputs="text"
15
+ )
16
 
 
17
  demo.launch()