Update app.py
Browse files
app.py
CHANGED
@@ -18,8 +18,6 @@ print("Loading Detoxify model... This may take a moment.")
|
|
18 |
detoxify_model = Detoxify('multilingual')
|
19 |
print("Model loaded successfully.")
|
20 |
|
21 |
-
API_KEY = os.getenv('API_KEY', 'your-api-key-here')
|
22 |
-
|
23 |
# --- Geliştirilmiş Metrik Takip Sistemi ---
|
24 |
request_durations = deque(maxlen=100)
|
25 |
request_timestamps = deque(maxlen=1000)
|
@@ -122,16 +120,6 @@ def moderations():
|
|
122 |
|
123 |
response = None
|
124 |
try:
|
125 |
-
auth_header = request.headers.get('Authorization')
|
126 |
-
if not auth_header or not auth_header.startswith("Bearer "):
|
127 |
-
response = jsonify({"error": "Unauthorized"}), 401
|
128 |
-
return response
|
129 |
-
|
130 |
-
provided_api_key = auth_header.split(" ")[1]
|
131 |
-
if provided_api_key != API_KEY:
|
132 |
-
response = jsonify({"error": "Unauthorized"}), 401
|
133 |
-
return response
|
134 |
-
|
135 |
data = request.get_json()
|
136 |
raw_input = data.get('input')
|
137 |
|
|
|
18 |
detoxify_model = Detoxify('multilingual')
|
19 |
print("Model loaded successfully.")
|
20 |
|
|
|
|
|
21 |
# --- Geliştirilmiş Metrik Takip Sistemi ---
|
22 |
request_durations = deque(maxlen=100)
|
23 |
request_timestamps = deque(maxlen=1000)
|
|
|
120 |
|
121 |
response = None
|
122 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
data = request.get_json()
|
124 |
raw_input = data.get('input')
|
125 |
|