Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from llama_cpp import Llama
|
| 3 |
+
|
| 4 |
+
# Load the model from Hugging Face
|
| 5 |
+
model_path = "YOUR_USERNAME/mysqlmodel/mysqlmodel.gguf"
|
| 6 |
+
|
| 7 |
+
llm = Llama(model_path=model_path, n_ctx=2048)
|
| 8 |
+
|
| 9 |
+
def chat(prompt):
|
| 10 |
+
output = llm(prompt)
|
| 11 |
+
return output["choices"][0]["text"]
|
| 12 |
+
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=chat,
|
| 15 |
+
inputs="text",
|
| 16 |
+
outputs="text",
|
| 17 |
+
title="MySQL LLM",
|
| 18 |
+
description="Finetuned MySQL AI model"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
iface.launch()
|