Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,11 +5,11 @@ import requests
|
|
5 |
import json
|
6 |
import random
|
7 |
import uuid
|
8 |
-
import concurrent.
|
9 |
import base64
|
10 |
import io
|
11 |
import threading
|
12 |
-
from PIL import
|
13 |
from datetime import datetime, timedelta
|
14 |
from apscheduler.schedulers.background import BackgroundScheduler
|
15 |
from flask import Flask, request, jsonify, Response, stream_with_context
|
@@ -365,17 +365,16 @@ def get_all_models(api_key, sub_type):
|
|
365 |
)
|
366 |
return []
|
367 |
|
368 |
-
def determine_request_type(model_name,
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
return "free_image"
|
377 |
else:
|
378 |
-
return
|
379 |
|
380 |
def select_key(request_type, model_name):
|
381 |
"""
|
|
|
5 |
import json
|
6 |
import random
|
7 |
import uuid
|
8 |
+
import concurrent.fu
|
9 |
import base64
|
10 |
import io
|
11 |
import threading
|
12 |
+
from PIL import Imagetures
|
13 |
from datetime import datetime, timedelta
|
14 |
from apscheduler.schedulers.background import BackgroundScheduler
|
15 |
from flask import Flask, request, jsonify, Response, stream_with_context
|
|
|
365 |
)
|
366 |
return []
|
367 |
|
368 |
+
def determine_request_type(model_name, model_list, free_model_list):
|
369 |
+
"""
|
370 |
+
根据用户请求的模型判断请求类型。
|
371 |
+
"""
|
372 |
+
if model_name in free_model_list:
|
373 |
+
return "free"
|
374 |
+
elif model_name in model_list:
|
375 |
+
return "paid"
|
|
|
376 |
else:
|
377 |
+
return "unknown"
|
378 |
|
379 |
def select_key(request_type, model_name):
|
380 |
"""
|