eliza555beth2002 commited on
Commit
f2c30d1
·
verified ·
1 Parent(s): 1569b94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -1,17 +1,18 @@
1
  from llama_cpp import Llama
2
  import gradio as gr
3
 
4
- # Загружаем твою GGUF-модель (добавь файл модели в этот Space)
5
- model = Llama(model_path="DeepSeek-R1-Distill-Text2SQL-OneEpoch-GGUF-q4.gguf")
6
 
7
- def generate_sql(prompt):
8
- result = model(prompt, max_tokens=256)
9
- return result["choices"][0]["text"]
 
 
 
10
 
11
- gr.Interface(
12
- fn=generate_sql,
13
- inputs="text",
14
- outputs="text",
15
- title="DeepSeek Text2SQL",
16
- description="Вводи вопрос на естественном языке и получай SQL-запрос."
17
- ).launch()
 
1
  from llama_cpp import Llama
2
  import gradio as gr
3
 
4
+ MODEL_URL = "https://huggingface.co/eliza555beth2002/DeepSeek-R1-Distill-Text2SQL-OneEpoch-GGUF-q4/resolve/main/model.gguf"
 
5
 
6
+ llm = Llama(
7
+ model_path=MODEL_URL, # можно подставить ссылку на модель
8
+ n_ctx=4096,
9
+ n_threads=4,
10
+ n_gpu_layers=50,
11
+ )
12
 
13
+ def text2sql(question):
14
+ prompt = f"Создай SQL-запрос для вопроса: {question}"
15
+ output = llm(prompt)
16
+ return output['choices'][0]['text']
17
+
18
+ gr.Interface(fn=text2sql, inputs="text", outputs="text", title="Text2SQL Demo").launch()