Update app.py
Browse files
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 |
-
|
| 6 |
|
| 7 |
-
def
|
| 8 |
-
output =
|
| 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()
|