sdxl-detector2 / app.py
goldenbrown's picture
Update app.py
2d1b3f8 verified
raw
history blame contribute delete
648 Bytes
import os
import requests
from flask import Flask, request, jsonify
app = Flask(__name__)
# Get Hugging Face API key from environment variables
API_URL = "https://api-inference.huggingface.co/models/Organika/sdxl-detector"
API_KEY = os.getenv('TOKEN')
@app.route('/check_image', methods=['POST'])
def check_image():
# Get image data from the request
image = request.files['image'].read()
headers = {
"Authorization": f"Bearer {API_KEY}"
}
response = requests.post(API_URL, headers=headers, files={"inputs": image})
return jsonify(response.json())
if __name__ == '__main__':
app.run(host='0.0.0.0', port=7860)