ysharma HF staff commited on
Commit
e8037e0
1 Parent(s): 4c52314
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -60,8 +60,14 @@ 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
- 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:
@@ -96,7 +102,7 @@ with demo:
96
  "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")
97
  #"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")
98
 
99
- with gr.Row():
100
  input_prompt_sql = gr.Textbox(label="Or Write text to get SQL commands...")
101
  #input_prompt_dalle2 = gr.Textbox(label="Or Write sample Dalle2 prompts to get more Prompt ideas...")
102
 
 
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 '\nOutput:' in solution:
64
+ final_solution = solution.split("\nOutput:")[0]
65
+ print(f"Response after removing output is: {final_solution}")
66
+ elif '\n\n' in solution:
67
+ final_solution = solution.split("\nOutput:")[0]
68
+ print(f"Response after removing new line entries is: {final_solution}")
69
+ else:
70
+ final_solution = solution
71
 
72
  #if "\n\n" not in output_tmp:
73
  # if output_tmp.find('.') != -1:
 
102
  "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")
103
  #"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")
104
 
105
+ #with gr.Row():
106
  input_prompt_sql = gr.Textbox(label="Or Write text to get SQL commands...")
107
  #input_prompt_dalle2 = gr.Textbox(label="Or Write sample Dalle2 prompts to get more Prompt ideas...")
108