Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -52,9 +52,10 @@ ENDPOINT_URL="https://api-inference.huggingface.co/models/stabilityai/stable-dif
|
|
52 |
#ENDPOINT_URL="https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-1-5" # url of your endpoint
|
53 |
HF_TOKEN=API_TOKEN# token where you deployed your endpoint
|
54 |
|
|
|
55 |
def generate_image(prompt_SD:str):
|
56 |
print(prompt_SD)
|
57 |
-
payload = {"inputs": prompt_SD,"seed":random.randint(0,100),"negative_prompt":
|
58 |
"width": 768,
|
59 |
"height": 768,
|
60 |
|
@@ -65,7 +66,7 @@ def generate_image(prompt_SD:str):
|
|
65 |
"Accept": "image/png" # important to get an image back
|
66 |
}
|
67 |
response = requests.post(ENDPOINT_URL, headers=headers, json=payload)
|
68 |
-
print(response.content)
|
69 |
img = Image.open(BytesIO(response.content))
|
70 |
|
71 |
return img
|
|
|
52 |
#ENDPOINT_URL="https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-1-5" # url of your endpoint
|
53 |
HF_TOKEN=API_TOKEN# token where you deployed your endpoint
|
54 |
|
55 |
+
neg_prompt="Not tee shirt, out of frame, lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, out of frame, extra fingers, mutated hands, poorly drawn face, blurry, bad proportions, extra limbs, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"
|
56 |
def generate_image(prompt_SD:str):
|
57 |
print(prompt_SD)
|
58 |
+
payload = {"inputs": prompt_SD,"seed":random.randint(0,100),"negative_prompt":neg_prompt,"parameters": {
|
59 |
"width": 768,
|
60 |
"height": 768,
|
61 |
|
|
|
66 |
"Accept": "image/png" # important to get an image back
|
67 |
}
|
68 |
response = requests.post(ENDPOINT_URL, headers=headers, json=payload)
|
69 |
+
#print(response.content)
|
70 |
img = Image.open(BytesIO(response.content))
|
71 |
|
72 |
return img
|