Ashrafb commited on
Commit
5da4270
1 Parent(s): eec6016

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -0
main.py CHANGED
@@ -123,6 +123,14 @@ def get_prompts(prompt_text):
123
  else:
124
  return text_gen("", timestamp)
125
 
 
 
 
 
 
 
 
 
126
  @app.get("/generate_prompts")
127
  def generate_prompts(prompt_text: str):
128
  return get_prompts(prompt_text)
 
123
  else:
124
  return text_gen("", timestamp)
125
 
126
+ def initialize_api_connection():
127
+ global headers
128
+ API_TOKEN = os.getenv("HF_READ_TOKEN") # it is free
129
+ headers = {"Authorization": f"Bearer {API_TOKEN}"}
130
+
131
+ # Run initialization functions on startup
132
+ initialize_api_connection()
133
+
134
  @app.get("/generate_prompts")
135
  def generate_prompts(prompt_text: str):
136
  return get_prompts(prompt_text)