Sarveshyadav19 commited on
Commit
fd1458a
·
verified ·
1 Parent(s): 575984c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline(
5
+ "text-generation",
6
+ model="Sarveshyadav19/text2sql-qwen-v3"
7
+ )
8
+
9
+ def generate_sql(question):
10
+
11
+ prompt = f"""
12
+ ### Question:
13
+ {question}
14
+
15
+ ### SQL:
16
+ """
17
+
18
+ result = pipe(
19
+ prompt,
20
+ max_new_tokens=100,
21
+ do_sample=False
22
+ )
23
+
24
+ return result[0]["generated_text"]
25
+
26
+ demo = gr.Interface(
27
+ fn=generate_sql,
28
+ inputs="text",
29
+ outputs="text",
30
+ title="Text to SQL Generator"
31
+ )
32
+
33
+ demo.launch()