master
ZhuYan 4 years ago
parent 1dcd26a492
commit ff5e30025f

@ -2,7 +2,6 @@
from removebg import RemoveBg
from django.http import JsonResponse
from django.views.decorators.http import require_POST,require_GET
from matplotlib import pyplot as plt
import sys
import imutils
from PIL import Image
@ -11,8 +10,7 @@ import urllib.request
import base64
import cv2
import numpy as np
import numba as nb
from pyzbar.pyzbar import decode
# base64转cv
def base64tocv(imagecode):
strList = str(imagecode).split(',')

@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@ -23,9 +23,9 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-e&g+zu7l)zckobld^=ba^yz+tu10-tmuig6b&iaj@_b7)z9isg'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['*']
DATA_UPLOAD_MAX_MEMORY_SIZE = 10485760 # 设置为最大10M
@ -38,8 +38,6 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'actionDrive.apps.ActiondriveConfig',
'ageTransfer.apps.AgetransferConfig',
'basicFunction.apps.BasicfunctionConfig',
'styleTransfer.apps.StyletransferConfig',
]
@ -128,3 +126,21 @@ STATIC_URL = '/static/'
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = True
CORS_ORIGIN_WHITELIST = ('http://*.*.*.*:*', 'http://skyemperor.top:*', 'http://localhost', 'http://127.0.0.1')
CORS_ALLOW_METHODS = (
'DELETE',
'GET',
'OPTIONS',
'PATCH',
'POST',
'PUT',
'VIEW',
)
CORS_ALLOW_HEADERS = ('*',)

@ -1,7 +1,6 @@
from django.contrib import admin
from django.urls import path
from django.conf.urls import url
import sys
sys.path.append("../")
from basicFunction import views as basic_function_view

@ -58,7 +58,7 @@ def style_transfer(request):
return JsonResponse(data={"image": output, "height": h, "width": w},
json_dumps_params={'ensure_ascii': False})
# model_base_dir = "/root/imageProcess/styleTransfer/models/"
model_base_dir = "F:\imageprocess\imageProcess\styleTransfer\models\\"
d_model_map = {
0: "candy",

Loading…
Cancel
Save