Update app.py
Browse files
app.py
CHANGED
|
@@ -4,19 +4,16 @@ app = Flask(__name__)
|
|
| 4 |
@app.route('/api/v1/image', methods=['POST'])
|
| 5 |
def generate_image():
|
| 6 |
data = request.get_json()
|
| 7 |
-
if '
|
| 8 |
return jsonify({'error': 'Missing required parameters'}), 400
|
| 9 |
-
|
| 10 |
-
headers = {'Authorization': data['apiKey']}
|
| 11 |
post_data = {
|
| 12 |
-
'model': data['
|
| 13 |
'prompt': data['prompt'],
|
| 14 |
'userId': data['userId']
|
| 15 |
}
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
response = requests.post('https://api.example.com/v1/image', headers=headers, json=post_data)
|
| 20 |
print(response.json())
|
| 21 |
return response.json()
|
| 22 |
if __name__ == '__main__':
|
|
|
|
| 4 |
@app.route('/api/v1/image', methods=['POST'])
|
| 5 |
def generate_image():
|
| 6 |
data = request.get_json()
|
| 7 |
+
if 'APIKEY' not in data or 'prompt' not in data or 'userId' not in data:
|
| 8 |
return jsonify({'error': 'Missing required parameters'}), 400
|
| 9 |
+
headers = {'Authorization': data['APIKEY']}
|
|
|
|
| 10 |
post_data = {
|
| 11 |
+
'model': data['ii'],
|
| 12 |
'prompt': data['prompt'],
|
| 13 |
'userId': data['userId']
|
| 14 |
}
|
| 15 |
+
print(data['ii'])
|
| 16 |
+
response = requests.post('https://api.ddosxd.ru/v1/image', headers=headers, json=post_data)
|
|
|
|
|
|
|
| 17 |
print(response.json())
|
| 18 |
return response.json()
|
| 19 |
if __name__ == '__main__':
|