ysharma HF staff commited on
Commit
816523e
·
1 Parent(s): fba21b8
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -4,7 +4,8 @@ import os
4
 
5
  ##Bloom
6
  API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
7
- headers = {"Authorization": "Bearer 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"}
 
8
 
9
  #def query(payload):
10
  # response = requests.post(API_URL, headers=headers, json=payload)
@@ -52,14 +53,14 @@ examples = [["river"], ["night"], ["trees"],["table"],["laughs"]]
52
 
53
  def text_generate(prompt):
54
 
55
- #p = prompt + word.lower() + "\n" + "poem using word: "
56
  print(f"*****Inside poem_generate - Prompt is :{prompt}")
57
  json_ = {"inputs": prompt,
58
  "parameters":
59
  {
60
  "top_p": 0.9,
61
  "temperature": 1.1,
62
- "max_new_tokens": 300,
63
  "return_full_text": False
64
  }}
65
  response = requests.post(API_URL, headers=headers, json=json_)
 
4
 
5
  ##Bloom
6
  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 query(payload):
11
  # response = requests.post(API_URL, headers=headers, json=payload)
 
53
 
54
  def text_generate(prompt):
55
 
56
+ #p = prompt .lower() + "\n" + "poem using word: "
57
  print(f"*****Inside poem_generate - Prompt is :{prompt}")
58
  json_ = {"inputs": prompt,
59
  "parameters":
60
  {
61
  "top_p": 0.9,
62
  "temperature": 1.1,
63
+ "max_new_tokens": 200,
64
  "return_full_text": False
65
  }}
66
  response = requests.post(API_URL, headers=headers, json=json_)