samim commited on
Commit
3a30d63
1 Parent(s): 2588225
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -7,13 +7,13 @@ API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
7
  HF_TOKEN = os.environ["HF_TOKEN"]
8
  headers = {"Authorization": f"Bearer {HF_TOKEN}"}
9
 
10
- def sql_generate(prompt, input_prompt_sql ):
11
 
12
- print(f"*****Inside SQL_generate - Prompt is :{prompt}")
13
- print(f"length of input_prompt_sql is {len(input_prompt_sql)}")
14
  print(f"length of prompt is {len(prompt)}")
15
  if len(prompt) == 0:
16
- prompt = input_prompt_sql
17
 
18
  json_ = {"inputs": prompt,
19
  "parameters":
@@ -58,13 +58,13 @@ with demo:
58
  example_prompt = gr.Radio( ["Once upon a time in a land far away"], label= "Choose a sample Prompt")
59
 
60
  #with gr.Column:
61
- input_prompt_sql = gr.Textbox(label="Write text to prompt the model", value="Once upon a time in a land far away", lines=6)
62
 
63
  with gr.Row():
64
  generated_txt = gr.Textbox(lines=3)
65
 
66
  b1 = gr.Button("Generate Text")
67
- b1.click(sql_generate,inputs=[example_prompt, input_prompt_sql], outputs=generated_txt)
68
 
69
  with gr.Row():
70
  gr.Markdown("![visitor badge](https://visitor-badge.glitch.me/badge?page_id=samim-bloom-exploration)")
 
7
  HF_TOKEN = os.environ["HF_TOKEN"]
8
  headers = {"Authorization": f"Bearer {HF_TOKEN}"}
9
 
10
+ def text_generate(prompt, input_prompt):
11
 
12
+ print(f"*****Inside TEXT_generate - Prompt is :{prompt}")
13
+ print(f"length of input_prompt is {len(input_prompt)}")
14
  print(f"length of prompt is {len(prompt)}")
15
  if len(prompt) == 0:
16
+ prompt = input_prompt
17
 
18
  json_ = {"inputs": prompt,
19
  "parameters":
 
58
  example_prompt = gr.Radio( ["Once upon a time in a land far away"], label= "Choose a sample Prompt")
59
 
60
  #with gr.Column:
61
+ input_prompt = gr.Textbox(label="Write text to prompt the model", value="Once upon a time in a land far away", lines=6)
62
 
63
  with gr.Row():
64
  generated_txt = gr.Textbox(lines=3)
65
 
66
  b1 = gr.Button("Generate Text")
67
+ b1.click(text_generate,inputs=[example_prompt, input_prompt], outputs=generated_txt)
68
 
69
  with gr.Row():
70
  gr.Markdown("![visitor badge](https://visitor-badge.glitch.me/badge?page_id=samim-bloom-exploration)")