Spaces:
Sleeping
Sleeping
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 |
-
|
12 |
|
13 |
st.title("Image Generator with Diffusers")
|
14 |
|
15 |
-
def query(payload):
|
16 |
-
response = requests.post(API_URL, headers=
|
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 |
|