Create requests
Browse files
requests
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
# (Configura莽茫o do endpoint e da chave API)
|
| 3 |
+
|
| 4 |
+
def generate_image(prompt):
|
| 5 |
+
headers = {"Authorization": "Bearer SEU_TOKEN_AQUI"}
|
| 6 |
+
payload = {"inputs": prompt}
|
| 7 |
+
|
| 8 |
+
response = requests.post(ENDPOINT_DO_PROVEDOR, headers=headers, json=payload)
|
| 9 |
+
|
| 10 |
+
# (C贸digo para processar a resposta e exibir a imagem)
|
| 11 |
+
# ...
|
| 12 |
+
return processed_image
|