ysharma HF staff commited on
Commit
0f291ad
1 Parent(s): 6638f21
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -32,18 +32,19 @@ A: Let’s think step by step.
32
 
33
 
34
 
35
- def text_generate(prompt, input_prompt):
36
 
37
  print(f"*****Inside poem_generate - Prompt is :{prompt}")
38
- if input_prompt != '':
39
- prompt = input_prompt
 
40
  json_ = {"inputs": prompt,
41
  "parameters":
42
  {
43
  "top_p": 0.9,
44
  "temperature": 1.1,
45
  "max_new_tokens": 250,
46
- "return_full_text": True,
47
  },
48
  "options":
49
  {"use_cache": True,
@@ -80,8 +81,8 @@ with demo:
80
  )
81
  with gr.Row():
82
  #example_prompt = gr.Radio( ["Q: A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there?\nA: Let’s think step by step.\n"], label= "Choose a sample Prompt")
83
- 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: "], label= "Choose a sample Prompt")
84
- input_prompt = gr.Textbox(label="Or Write text to get SQL commands...")
85
 
86
  #input_word = gr.Textbox(placeholder="Enter a word here to generate text ...")
87
  generated_txt = gr.Textbox(lines=7)
@@ -90,7 +91,7 @@ with demo:
90
  b1 = gr.Button("Generate SQL")
91
  #b2 = gr.Button("Generate Image")
92
 
93
- b1.click(text_generate,inputs=[example_prompt, input_prompt], outputs=generated_txt) #input_word
94
  #b2.click(poem_to_image, poem_txt, output_image)
95
  #examples=examples
96
 
 
32
 
33
 
34
 
35
+ def text_generate(prompt, input_prompt_sql):
36
 
37
  print(f"*****Inside poem_generate - Prompt is :{prompt}")
38
+ if input_prompt_sql != '':
39
+ prompt = "Instruction: Given an input question, respond with syntactically correct PostgreSQL\nInput: " +input_prompt_sql + "\nPostgreSQL query: "
40
+
41
  json_ = {"inputs": prompt,
42
  "parameters":
43
  {
44
  "top_p": 0.9,
45
  "temperature": 1.1,
46
  "max_new_tokens": 250,
47
+ "return_full_text": False,
48
  },
49
  "options":
50
  {"use_cache": True,
 
81
  )
82
  with gr.Row():
83
  #example_prompt = gr.Radio( ["Q: A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there?\nA: Let’s think step by step.\n"], label= "Choose a sample Prompt")
84
+ 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: ", "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\nPrompt: " ], label= "Choose a sample Prompt")
85
+ input_prompt_sql = gr.Textbox(label="Or Write text to get SQL commands...")
86
 
87
  #input_word = gr.Textbox(placeholder="Enter a word here to generate text ...")
88
  generated_txt = gr.Textbox(lines=7)
 
91
  b1 = gr.Button("Generate SQL")
92
  #b2 = gr.Button("Generate Image")
93
 
94
+ b1.click(text_generate,inputs=[example_prompt, input_prompt_sql], outputs=generated_txt) #input_word
95
  #b2.click(poem_to_image, poem_txt, output_image)
96
  #examples=examples
97