role_test.py 705 B

12345678910111213141516171819202122232425262728293031323334
  1. from fastapi import FastAPI,Cookie, Depends, Query, status,File, UploadFile,Request,Response,HTTPException
  2. import threading
  3. import rpyc
  4. import random
  5. import time
  6. import math
  7. import hashlib
  8. import re
  9. from fastapi.middleware.cors import CORSMiddleware
  10. import dataset
  11. from datetime import datetime, timedelta
  12. from util.swap_face import swap_face
  13. from fastapi.staticfiles import StaticFiles
  14. import io
  15. from first import first
  16. import models
  17. import pymysql
  18. import traceback
  19. import logging
  20. import util.user
  21. mode = 'run'
  22. app.add_middleware(
  23. CORSMiddleware,
  24. allow_origins=["*"],
  25. allow_credentials=True,
  26. allow_methods=["*"],
  27. allow_headers=["*"],
  28. )
  29. pymysql.install_as_MySQLdb()
  30. app = FastAPI()