File size: 528 Bytes
df7a119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from prompt_generator import generate_prompt
from gpt4o_infer import call_gpt4o

def nlp_to_sql(nl_query, schema_text):
    prompt = generate_prompt(nl_query, schema_text)
    sql = call_gpt4o(prompt)
    return sql

iface = gr.Interface(
    fn=nlp_to_sql,
    inputs=[gr.Textbox(label="Natural Language Query"), gr.Textbox(label="Schema in Natural Format")],
    outputs="text",
    title="NLP to SQL with GPT-4o",
    description="Enter your natural language query and schema to get SQL"
)

iface.launch()