ysharma HF staff commited on
Commit
3cc1aef
1 Parent(s): 6fd51d7

update layout and examples

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -31,10 +31,10 @@ def sql_generate(prompt, input_prompt_sql ):
31
  response = requests.post(API_URL, headers=headers, json=json_)
32
  print(f"Response is : {response}")
33
  output = response.json()
34
- print(f"output is : {output}") #{output}")
35
  output_tmp = output[0]['generated_text']
36
  print(f"output_tmp is: {output_tmp}")
37
- solution = output_tmp.split("\nQ:")[0] #output[0]['generated_text'].split("Q:")[0] # +"."
38
  print(f"Final response after splits is: {solution}")
39
  if '\nOutput:' in solution:
40
  final_solution = solution.split("\nOutput:")[0]
@@ -66,11 +66,11 @@ with demo:
66
  "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use table called 'employees'.\nInput: Select names of all the employees who are working under 'Peter'\nPostgreSQL query: ", ], label= "Choose a sample Prompt")
67
 
68
  #with gr.Column:
69
- input_prompt_sql = gr.Textbox(label="Or Write text following the example pattern given below, to get SQL commands...", value="Only use table called 'department'.\nInput: Select names of all the departments in descending alphabetical order of department names.\nPostgreSQL query: ", lines=5)
70
 
71
  with gr.Row():
72
- generated_txt = gr.Textbox(lines=3)
73
  b1 = gr.Button("Generate SQL")
 
74
 
75
  b1.click(sql_generate,inputs=[example_prompt, input_prompt_sql], outputs=generated_txt)
76
 
 
31
  response = requests.post(API_URL, headers=headers, json=json_)
32
  print(f"Response is : {response}")
33
  output = response.json()
34
+ print(f"output is : {output}")
35
  output_tmp = output[0]['generated_text']
36
  print(f"output_tmp is: {output_tmp}")
37
+ solution = output_tmp.split("\nQ:")[0]
38
  print(f"Final response after splits is: {solution}")
39
  if '\nOutput:' in solution:
40
  final_solution = solution.split("\nOutput:")[0]
 
66
  "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use table called 'employees'.\nInput: Select names of all the employees who are working under 'Peter'\nPostgreSQL query: ", ], label= "Choose a sample Prompt")
67
 
68
  #with gr.Column:
69
+ input_prompt_sql = gr.Textbox(label="Or Write text following the example pattern given below, to get SQL commands...", value="Use table called 'department'.\nInput: Select names of all the departments in their descending alphabetical order.\nPostgreSQL query: ", lines=5)
70
 
71
  with gr.Row():
 
72
  b1 = gr.Button("Generate SQL")
73
+ generated_txt = gr.Textbox(lines=3)
74
 
75
  b1.click(sql_generate,inputs=[example_prompt, input_prompt_sql], outputs=generated_txt)
76