ghosthamlet commited on
Commit
ea0b4a3
1 Parent(s): f333bc0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -6,6 +6,7 @@ import os
6
  API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
7
 
8
  headers = {"Authorization": f"Bearer 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"}
 
9
 
10
 
11
  def text_generate(prompt, top_p=0.8, top_k=100, temperature=1.0, num_beams=3, repetition_penalty=3.0):
@@ -47,7 +48,6 @@ def text_generate(prompt, top_p=0.8, top_k=100, temperature=1.0, num_beams=3, re
47
  else:
48
  final_solution = solution
49
 
50
- prompt_sep = ' @@@ '
51
  final_solution = prompt[:max(0, len(prompt) - max_prompt_len)].replace(prompt_sep, '') + prompt_sep + final_solution.replace(prompt_sep, '')
52
 
53
  if 0:
@@ -91,7 +91,7 @@ with demo:
91
  """Forked form https://huggingface.co/spaces/EuroPython2022/Write-Stories-Using-Bloom. \n Bloom is a model by [HuggingFace](https://huggingface.co/bigscience/bloom) and a team of more than 1000 researchers coming together as [BigScienceW Bloom](https://twitter.com/BigscienceW).\n\nLarge language models have demonstrated a capability of producing coherent sentences and given a context we can pretty much decide the *theme* of generated text.\n\nHow to Use this App: Use the sample text given as prompt or type in a new prompt as a starting point of your awesome story! Just keep pressing the 'Generate Text' Button and go crazy!\n\nHow this App works: This app operates by feeding back the text generated by Bloom to itself as a Prompt for next generation round and so on. Currently, due to size-limits on Prompt and Token generation, we are only able to feed very limited-length text as Prompt and are getting very few tokens generated in-turn. This makes it difficult to keep a tab on theme of text generation, so please bear with that. In summary, I believe it is a nice little fun App which you can play with for a while.\n\nThis Space is created by [Yuvraj Sharma](https://twitter.com/yvrjsharma) for EuroPython 2022 Demo."""
92
  )
93
  with gr.Row():
94
- input_prompt = gr.Textbox(label="Write some text to get started... (text after @@ is the truncated prompt inputted to Bloom)", lines=3, value="Dear human philosophers, I read your comments on my abilities and limitations with great interest.")
95
 
96
  # with gr.Row():
97
  # generated_txt = gr.Textbox(lines=7, visible = False)
 
6
  API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
7
 
8
  headers = {"Authorization": f"Bearer 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"}
9
+ prompt_sep = ' @@@ '
10
 
11
 
12
  def text_generate(prompt, top_p=0.8, top_k=100, temperature=1.0, num_beams=3, repetition_penalty=3.0):
 
48
  else:
49
  final_solution = solution
50
 
 
51
  final_solution = prompt[:max(0, len(prompt) - max_prompt_len)].replace(prompt_sep, '') + prompt_sep + final_solution.replace(prompt_sep, '')
52
 
53
  if 0:
 
91
  """Forked form https://huggingface.co/spaces/EuroPython2022/Write-Stories-Using-Bloom. \n Bloom is a model by [HuggingFace](https://huggingface.co/bigscience/bloom) and a team of more than 1000 researchers coming together as [BigScienceW Bloom](https://twitter.com/BigscienceW).\n\nLarge language models have demonstrated a capability of producing coherent sentences and given a context we can pretty much decide the *theme* of generated text.\n\nHow to Use this App: Use the sample text given as prompt or type in a new prompt as a starting point of your awesome story! Just keep pressing the 'Generate Text' Button and go crazy!\n\nHow this App works: This app operates by feeding back the text generated by Bloom to itself as a Prompt for next generation round and so on. Currently, due to size-limits on Prompt and Token generation, we are only able to feed very limited-length text as Prompt and are getting very few tokens generated in-turn. This makes it difficult to keep a tab on theme of text generation, so please bear with that. In summary, I believe it is a nice little fun App which you can play with for a while.\n\nThis Space is created by [Yuvraj Sharma](https://twitter.com/yvrjsharma) for EuroPython 2022 Demo."""
92
  )
93
  with gr.Row():
94
+ input_prompt = gr.Textbox(label=f"Write some text to get started... (text after {prompt_sep} is the truncated prompt inputted to Bloom)", lines=3, value="Dear human philosophers, I read your comments on my abilities and limitations with great interest.")
95
 
96
  # with gr.Row():
97
  # generated_txt = gr.Textbox(lines=7, visible = False)