Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|