yangtb24 commited on
Commit
2f8cff3
1 Parent(s): 92a55e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -5,11 +5,11 @@ import requests
5
  import json
6
  import random
7
  import uuid
8
- import concurrent.futures
9
  import base64
10
  import io
11
  import threading
12
- from PIL import Image
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, text_models, free_text_models, image_models, free_image_models):
369
- if model_name in text_models:
370
- return "text"
371
- elif model_name in free_text_models:
372
- return "free_text"
373
- elif model_name in image_models:
374
- return "image"
375
- elif model_name in free_image_models:
376
- return "free_image"
377
  else:
378
- return None
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
  """