Spaces:
Running
Running
File size: 648 Bytes
93ce3d2 2d1b3f8 93ce3d2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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) |