Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,10 +3,13 @@ import requests
|
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
5 |
|
|
|
|
|
|
|
6 |
# Função para gerar imagem usando a API do Hugging Face
|
7 |
def generate_image(prompt: str):
|
8 |
API_URL = "https://api-inference.huggingface.co/models/CompVis/stable-diffusion-v1-4"
|
9 |
-
headers = {"Authorization": f"Bearer
|
10 |
|
11 |
response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
|
12 |
|
|
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
5 |
|
6 |
+
# Substitua 'YOUR_HUGGINGFACE_API_KEY' pela sua chave de API real
|
7 |
+
API_KEY = "YOUR_HUGGINGFACE_API_KEY"
|
8 |
+
|
9 |
# Função para gerar imagem usando a API do Hugging Face
|
10 |
def generate_image(prompt: str):
|
11 |
API_URL = "https://api-inference.huggingface.co/models/CompVis/stable-diffusion-v1-4"
|
12 |
+
headers = {"Authorization": f"Bearer {API_KEY}"}
|
13 |
|
14 |
response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
|
15 |
|