ysharma HF staff commited on
Commit
1484fcc
1 Parent(s): b5e28dd
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -32,11 +32,11 @@ A: Let’s think step by step.
32
 
33
 
34
 
35
- def text_generate(prompt, input_prompt_sql ): #, input_prompt_dalle2):
36
 
37
  print(f"*****Inside poem_generate - Prompt is :{prompt}")
38
- if input_prompt_sql != '':
39
- prompt = input_prompt_sql #"Instruction: Given an input question, respond with syntactically correct PostgreSQL\nInput: " +input_prompt_sql + "\nPostgreSQL query: "
40
  #elif input_prompt_dalle2 !='':
41
  # prompt = "Dalle Prompt: " + input_prompt_dalle2 + "\nNew Dalle Prompt: "
42
 
@@ -80,7 +80,8 @@ def text_generate(prompt, input_prompt_sql ): #, input_prompt_dalle2):
80
  # poem = output_tmp.split("\n\n")[0] # +"."
81
  #poem = poem.replace('?','')
82
  #print(f"Poem being returned is: {poem}")
83
- return final_solution #solution #output #response #output_tmp #poem
 
84
 
85
 
86
  demo = gr.Blocks()
@@ -103,18 +104,18 @@ with demo:
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 = gr.Textbox(label="Write some text to get started...") #input_prompt_sql
107
  #input_prompt_dalle2 = gr.Textbox(label="Or Write sample Dalle2 prompts to get more Prompt ideas...")
108
-
109
  #input_word = gr.Textbox(placeholder="Enter a word here to generate text ...")
110
  with gr.Row():
111
- generated_txt = gr.Textbox(lines=15)
112
  #output_image = gr.Image(type="filepath", shape=(256,256))
113
 
114
  b1 = gr.Button("Generate Text")
115
  #b2 = gr.Button("Generate Image")
116
 
117
- b1.click(text_generate,inputs=input_pr, outputs=generated_txt) #input_word #input_prompt_dalle2 #input_prompt_sql #example_prompt
118
  #b2.click(poem_to_image, poem_txt, output_image)
119
  #examples=examples
120
 
 
32
 
33
 
34
 
35
+ def text_generate(prompt): #, input_prompt_sql ): #, input_prompt_dalle2):
36
 
37
  print(f"*****Inside poem_generate - Prompt is :{prompt}")
38
+ #if input_prompt_sql != '':
39
+ # prompt = input_prompt_sql #"Instruction: Given an input question, respond with syntactically correct PostgreSQL\nInput: " +input_prompt_sql + "\nPostgreSQL query: "
40
  #elif input_prompt_dalle2 !='':
41
  # prompt = "Dalle Prompt: " + input_prompt_dalle2 + "\nNew Dalle Prompt: "
42
 
 
80
  # poem = output_tmp.split("\n\n")[0] # +"."
81
  #poem = poem.replace('?','')
82
  #print(f"Poem being returned is: {poem}")
83
+ prompt = final_solution[len(prompt):]
84
+ return final_solution, prompt #solution #output #response #output_tmp #poem
85
 
86
 
87
  demo = gr.Blocks()
 
104
  #"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")
105
 
106
  #with gr.Row():
107
+ input_prompt = gr.Textbox(label="Write some text to get started...", lines=15) #input_prompt_sql
108
  #input_prompt_dalle2 = gr.Textbox(label="Or Write sample Dalle2 prompts to get more Prompt ideas...")
109
+ #input_prompt2 = gr.Textbox(label="Write some text to get started...", lines=15) #input_prompt_sql
110
  #input_word = gr.Textbox(placeholder="Enter a word here to generate text ...")
111
  with gr.Row():
112
+ generated_txt = gr.Textbox(lines=15, visible = True)
113
  #output_image = gr.Image(type="filepath", shape=(256,256))
114
 
115
  b1 = gr.Button("Generate Text")
116
  #b2 = gr.Button("Generate Image")
117
 
118
+ b1.click(text_generate, inputs=input_prompt, outputs=[generated_txt, input_prompt]) #input_word #input_prompt_dalle2 #input_prompt_sql #example_prompt
119
  #b2.click(poem_to_image, poem_txt, output_image)
120
  #examples=examples
121