ysharma HF staff commited on
Commit
4d09f3b
·
1 Parent(s): 1c809af
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -60,6 +60,9 @@ def text_generate(prompt, input_prompt_sql, input_prompt_dalle2):
60
  print(f"output_tmp is: {output_tmp}")
61
  solution = output_tmp.split("\nQ:")[0] #output[0]['generated_text'].split("Q:")[0] # +"."
62
  print(f"Final response after splits is: {solution}")
 
 
 
63
  #if "\n\n" not in output_tmp:
64
  # if output_tmp.find('.') != -1:
65
  # idx = output_tmp.find('.')
@@ -86,10 +89,9 @@ with demo:
86
  example_prompt = gr.Radio( ["Instruction: Given an input question, respond with syntactically correct PostgreSQL\nInput: how many users signed up in the past month?\nPostgreSQL query: ",
87
  "Instruction: Given an input question, respond with syntactically correct PostgreSQL. 'employees' table columns are: emp_id (integer), emp_name (character varying), mgr_id (integer), hire_dt (timestamp), dept_id (character varying), and sal (integer). \nInput: What is total salary paid to employees?\nPostgreSQL query: ",
88
  "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use tables called 'employees'.\nInput: List name of all the employees whose name ends with 'r'?\nPostgreSQL query: ",
89
- "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use tables called 'employees' and 'department'. The 'employees' table has columns: employee_id (integer), employee_name (character varying), manager_id (integer), hire_date (timestamp), department_id (character varying), and salary (integer). The 'department' table has columns: department_id (character varying), department_name (character varying), and department_location (timestamp).\nInput: What is the number of employees in each department?\nPostgreSQL query: ",
90
- "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use tables called 'employees' and 'department'. The 'employees' table has columns: employee_id (integer), employee_name (character varying), manager_id (integer), hire_date (timestamp), department_id (character varying), and salary (integer). The 'department' table has columns: department_id (character varying), department_name (character varying), and department_location (timestamp).\nInput: What is the number of employees in each department?\nPostgreSQL query: ",
91
- "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use tables called 'employees' and 'department'. The 'employees' table has columns: employee_id (integer), employee_name (character varying), manager_id (integer), hire_date (timestamp), department_id (character varying), and salary (integer). The 'department' table has columns: department_id (character varying), department_name (character varying), and department_location (timestamp).\nInput: select the name of the employees whose name's 3rd charactor is 't'.\nPostgreSQL query: ",
92
- "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use tables called 'employees' and 'department'. The 'employees' table has columns: employee_id (integer), employee_name (character varying), manager_id (integer), hire_date (timestamp), department_id (character varying), and salary (integer). The 'department' table has columns: department_id (character varying), department_name (character varying), and department_location (timestamp).\nInput: Select the name of all the employee who are working under 'Peter'\nPostgreSQL query: ",
93
  "Dalle Prompt: Cyberwave vaporpunk art of a kneeling figure, looking up at a glowing neon book icon, smoke and mist, pink and blue lighting, cybernetic sci-fi render\nNew Dalle Prompt: " ], label= "Choose a sample Prompt")
94
 
95
  input_prompt_sql = gr.Textbox(label="Or Write text to get SQL commands...")
 
60
  print(f"output_tmp is: {output_tmp}")
61
  solution = output_tmp.split("\nQ:")[0] #output[0]['generated_text'].split("Q:")[0] # +"."
62
  print(f"Final response after splits is: {solution}")
63
+ final_solution = solution.split("\nOutput::")[0]
64
+ print(f"Response after removing output is: {final_solution}")
65
+
66
  #if "\n\n" not in output_tmp:
67
  # if output_tmp.find('.') != -1:
68
  # idx = output_tmp.find('.')
 
89
  example_prompt = gr.Radio( ["Instruction: Given an input question, respond with syntactically correct PostgreSQL\nInput: how many users signed up in the past month?\nPostgreSQL query: ",
90
  "Instruction: Given an input question, respond with syntactically correct PostgreSQL. 'employees' table columns are: emp_id (integer), emp_name (character varying), mgr_id (integer), hire_dt (timestamp), dept_id (character varying), and sal (integer). \nInput: What is total salary paid to employees?\nPostgreSQL query: ",
91
  "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use tables called 'employees'.\nInput: List name of all the employees whose name ends with 'r'?\nPostgreSQL query: ",
92
+ "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use tables called 'employees' and 'department'.\nInput: What is the number of employees in each department?\nPostgreSQL query: ",
93
+ "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use table called 'employees'.\nInput: select the name of the employees whose name's 3rd charactor is 't'.\nPostgreSQL query: ",
94
+ "Instruction: Given an input question, respond with syntactically correct PostgreSQL. Only use table called 'employees'.\nInput: Select the name of all the employee who are working under 'Peter'\nPostgreSQL query: ",
 
95
  "Dalle Prompt: Cyberwave vaporpunk art of a kneeling figure, looking up at a glowing neon book icon, smoke and mist, pink and blue lighting, cybernetic sci-fi render\nNew Dalle Prompt: " ], label= "Choose a sample Prompt")
96
 
97
  input_prompt_sql = gr.Textbox(label="Or Write text to get SQL commands...")