import openai import gradio as gr #OpenAi call def gpt3(texts): openai.api_key = "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" response = openai.Completion.create( engine="code-davinci-002", prompt= texts, temperature=0, max_tokens=750, top_p=1, frequency_penalty=0.0, presence_penalty=0.0, stop = (";", "/*", "") ) x = response.choices[0].text return x # Function to elicit sql response from model def greet( prompt): txt= (f'''/*Prompt: {prompt}*/ \n --SQL Code:''') sql = gpt3(txt) return sql #Code to set up Gradio UI iface = gr.Interface(greet, inputs = ["text"], outputs = "text",title="Natural Language to SQL", description="Enter any natural language prompt and get a SQL statement back") iface.launch()