LordFarquaad42 commited on
Commit
8da1e7a
·
verified ·
1 Parent(s): 637bad0
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -8,17 +8,17 @@ from dotenv import load_dotenv
8
  load_dotenv()
9
 
10
  API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-cascade-prior"
11
- headers = {"Authorization": f"Bearer ${os.getenv('bearer_token')}"}
12
 
13
  st.title("Image Generator with Diffusers")
14
 
15
- def query(payload):
16
- response = requests.post(API_URL, headers=headers, json=payload)
17
  return response.content
18
 
19
  prompt = st.text_input("Enter a prompt:", "batman hitting the griddy in gotham")
20
 
21
- image_bytes = query({
22
  "inputs": prompt,
23
  })
24
 
 
8
  load_dotenv()
9
 
10
  API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-cascade-prior"
11
+ HEADERS = {"Authorization": f"Bearer ${os.getenv('bearer_token')}"}
12
 
13
  st.title("Image Generator with Diffusers")
14
 
15
+ def async query(payload):
16
+ response = requests.post(API_URL, headers=HEADERS, json=payload)
17
  return response.content
18
 
19
  prompt = st.text_input("Enter a prompt:", "batman hitting the griddy in gotham")
20
 
21
+ image_bytes = await query({
22
  "inputs": prompt,
23
  })
24