Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,8 @@ from io import BytesIO
|
|
9 |
def generate_minecraft_command(description, image):
|
10 |
try:
|
11 |
headers = {
|
12 |
-
'Authorization': f'Bearer {os.getenv("API_KEY")}'
|
|
|
13 |
}
|
14 |
|
15 |
# Преобразуем изображение в формат bytes
|
@@ -25,7 +26,7 @@ def generate_minecraft_command(description, image):
|
|
25 |
'model': os.getenv("MODEL")
|
26 |
}
|
27 |
|
28 |
-
response = requests.post(os.getenv("BASE_URL"), headers=headers, data=data, files=files)
|
29 |
response.raise_for_status()
|
30 |
|
31 |
data = json.loads(response.text)
|
|
|
9 |
def generate_minecraft_command(description, image):
|
10 |
try:
|
11 |
headers = {
|
12 |
+
'Authorization': f'Bearer {os.getenv("API_KEY")}',
|
13 |
+
'Content-Type': 'application/json'
|
14 |
}
|
15 |
|
16 |
# Преобразуем изображение в формат bytes
|
|
|
26 |
'model': os.getenv("MODEL")
|
27 |
}
|
28 |
|
29 |
+
response = requests.post(os.getenv("BASE_URL"), headers=headers, data=json.dumps(data), files=files)
|
30 |
response.raise_for_status()
|
31 |
|
32 |
data = json.loads(response.text)
|