From 6910979d900bb8ec2001e973b5bd765db96acbb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=A8=8B?= <1225922531@qq.com> Date: Fri, 25 Jun 2021 17:50:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=A1=B9=E7=9B=AE=E7=9A=84Li?= =?UTF-8?q?nux=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/voiceproject-linux/.idea/.gitignore | 3 + .../inspectionProfiles/Project_Default.xml | 12 ++ .../inspectionProfiles/profiles_settings.xml | 6 + src/voiceproject-linux/.idea/misc.xml | 7 + src/voiceproject-linux/.idea/modules.xml | 8 ++ src/voiceproject-linux/.idea/voiceproject.iml | 15 +++ src/voiceproject-linux/db.sqlite3 | 0 src/voiceproject-linux/manage.py | 22 ++++ .../templates/train_list.html | 37 ++++++ .../templates/train_list.html~ | 37 ++++++ src/voiceproject-linux/templates/upload.html | 26 ++++ src/voiceproject-linux/voice_app/__init__.py | 0 .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 124 bytes .../__pycache__/admin.cpython-37.pyc | Bin 0 -> 165 bytes .../__pycache__/models.cpython-37.pyc | Bin 0 -> 162 bytes .../__pycache__/views.cpython-37.pyc | Bin 0 -> 2227 bytes src/voiceproject-linux/voice_app/admin.py | 3 + src/voiceproject-linux/voice_app/apps.py | 5 + .../voice_app/migrations/__init__.py | 0 .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 135 bytes src/voiceproject-linux/voice_app/models.py | 3 + src/voiceproject-linux/voice_app/tests.py | 3 + src/voiceproject-linux/voice_app/views.py | 96 ++++++++++++++ src/voiceproject-linux/voice_app/views.py~ | 93 ++++++++++++++ .../voiceproject/__init__.py | 0 .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 127 bytes .../__pycache__/settings.cpython-37.pyc | Bin 0 -> 2383 bytes .../__pycache__/urls.cpython-37.pyc | Bin 0 -> 1104 bytes .../__pycache__/wsgi.cpython-37.pyc | Bin 0 -> 540 bytes src/voiceproject-linux/voiceproject/asgi.py | 16 +++ .../voiceproject/settings.py | 121 ++++++++++++++++++ .../voiceproject/settings.py~ | 121 ++++++++++++++++++ src/voiceproject-linux/voiceproject/urls.py | 25 ++++ src/voiceproject-linux/voiceproject/urls.py~ | 25 ++++ src/voiceproject-linux/voiceproject/wsgi.py | 16 +++ 35 files changed, 700 insertions(+) create mode 100644 src/voiceproject-linux/.idea/.gitignore create mode 100644 src/voiceproject-linux/.idea/inspectionProfiles/Project_Default.xml create mode 100644 src/voiceproject-linux/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 src/voiceproject-linux/.idea/misc.xml create mode 100644 src/voiceproject-linux/.idea/modules.xml create mode 100644 src/voiceproject-linux/.idea/voiceproject.iml create mode 100644 src/voiceproject-linux/db.sqlite3 create mode 100644 src/voiceproject-linux/manage.py create mode 100644 src/voiceproject-linux/templates/train_list.html create mode 100644 src/voiceproject-linux/templates/train_list.html~ create mode 100644 src/voiceproject-linux/templates/upload.html create mode 100644 src/voiceproject-linux/voice_app/__init__.py create mode 100644 src/voiceproject-linux/voice_app/__pycache__/__init__.cpython-37.pyc create mode 100644 src/voiceproject-linux/voice_app/__pycache__/admin.cpython-37.pyc create mode 100644 src/voiceproject-linux/voice_app/__pycache__/models.cpython-37.pyc create mode 100644 src/voiceproject-linux/voice_app/__pycache__/views.cpython-37.pyc create mode 100644 src/voiceproject-linux/voice_app/admin.py create mode 100644 src/voiceproject-linux/voice_app/apps.py create mode 100644 src/voiceproject-linux/voice_app/migrations/__init__.py create mode 100644 src/voiceproject-linux/voice_app/migrations/__pycache__/__init__.cpython-37.pyc create mode 100644 src/voiceproject-linux/voice_app/models.py create mode 100644 src/voiceproject-linux/voice_app/tests.py create mode 100644 src/voiceproject-linux/voice_app/views.py create mode 100644 src/voiceproject-linux/voice_app/views.py~ create mode 100644 src/voiceproject-linux/voiceproject/__init__.py create mode 100644 src/voiceproject-linux/voiceproject/__pycache__/__init__.cpython-37.pyc create mode 100644 src/voiceproject-linux/voiceproject/__pycache__/settings.cpython-37.pyc create mode 100644 src/voiceproject-linux/voiceproject/__pycache__/urls.cpython-37.pyc create mode 100644 src/voiceproject-linux/voiceproject/__pycache__/wsgi.cpython-37.pyc create mode 100644 src/voiceproject-linux/voiceproject/asgi.py create mode 100644 src/voiceproject-linux/voiceproject/settings.py create mode 100644 src/voiceproject-linux/voiceproject/settings.py~ create mode 100644 src/voiceproject-linux/voiceproject/urls.py create mode 100644 src/voiceproject-linux/voiceproject/urls.py~ create mode 100644 src/voiceproject-linux/voiceproject/wsgi.py diff --git a/src/voiceproject-linux/.idea/.gitignore b/src/voiceproject-linux/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/src/voiceproject-linux/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/src/voiceproject-linux/.idea/inspectionProfiles/Project_Default.xml b/src/voiceproject-linux/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..75a9f69 --- /dev/null +++ b/src/voiceproject-linux/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/src/voiceproject-linux/.idea/inspectionProfiles/profiles_settings.xml b/src/voiceproject-linux/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/src/voiceproject-linux/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/src/voiceproject-linux/.idea/misc.xml b/src/voiceproject-linux/.idea/misc.xml new file mode 100644 index 0000000..4530676 --- /dev/null +++ b/src/voiceproject-linux/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/src/voiceproject-linux/.idea/modules.xml b/src/voiceproject-linux/.idea/modules.xml new file mode 100644 index 0000000..ff40c75 --- /dev/null +++ b/src/voiceproject-linux/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/voiceproject-linux/.idea/voiceproject.iml b/src/voiceproject-linux/.idea/voiceproject.iml new file mode 100644 index 0000000..4f2c9af --- /dev/null +++ b/src/voiceproject-linux/.idea/voiceproject.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/voiceproject-linux/db.sqlite3 b/src/voiceproject-linux/db.sqlite3 new file mode 100644 index 0000000..e69de29 diff --git a/src/voiceproject-linux/manage.py b/src/voiceproject-linux/manage.py new file mode 100644 index 0000000..1f05043 --- /dev/null +++ b/src/voiceproject-linux/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'voiceproject.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/src/voiceproject-linux/templates/train_list.html b/src/voiceproject-linux/templates/train_list.html new file mode 100644 index 0000000..35c10a7 --- /dev/null +++ b/src/voiceproject-linux/templates/train_list.html @@ -0,0 +1,37 @@ + + + + + train + + +
+ {% csrf_token %} + + +

+ +

+ + + + + + + + {% for username,voicenum in user_voicenum.items %} + + + + + + {% endfor %} +
用户名已保存音频数量操作
{{ username }} {{ voicenum }} + + + +
+ +
+ + diff --git a/src/voiceproject-linux/templates/train_list.html~ b/src/voiceproject-linux/templates/train_list.html~ new file mode 100644 index 0000000..f01dd45 --- /dev/null +++ b/src/voiceproject-linux/templates/train_list.html~ @@ -0,0 +1,37 @@ + + + + + train + + +
+ {% csrf_token %} + + +

+ +

+ + + + + + + + {% for username,voicenum in user_voicenum.items %} + + + + + + {% endfor %}--> +
用户名已保存音频数量操作
{{ username }} {{ voicenum }} + + + +
+ +
+ + diff --git a/src/voiceproject-linux/templates/upload.html b/src/voiceproject-linux/templates/upload.html new file mode 100644 index 0000000..3f53135 --- /dev/null +++ b/src/voiceproject-linux/templates/upload.html @@ -0,0 +1,26 @@ + + + + + upload + + +
+ {% csrf_token %} + + +
+ +

+ +

+ + + +
+ + + + \ No newline at end of file diff --git a/src/voiceproject-linux/voice_app/__init__.py b/src/voiceproject-linux/voice_app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/voiceproject-linux/voice_app/__pycache__/__init__.cpython-37.pyc b/src/voiceproject-linux/voice_app/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8b889a8291e1ed9eef6f1b3ce7cdcb6635fbe301 GIT binary patch literal 124 zcmZ?b<>g`kg1Hg<6F~H15CH>>K!yVl7qb9~6oz01O-8?!3`HPe1o2DN#VV#OKQlSC speR2pHMs=BiBBvjh>4HS%*!l^kJl@xyv1RYo1apelWGUj{uziF08+~v*Z=?k literal 0 HcmV?d00001 diff --git a/src/voiceproject-linux/voice_app/__pycache__/admin.cpython-37.pyc b/src/voiceproject-linux/voice_app/__pycache__/admin.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3f947c6637a5852f757ed24f54e3bedba9627de GIT binary patch literal 165 zcmZ?b<>g`kg1Hg<6P$qbV-N=hn1BoiATAaF5-AKRj5!Rsj8Tk?3@J>(44TX@fuanW zjJH@5Q*tx&{4|-O_)@YG^V0M6lJoOQiZYXmKnAR2C}IXuVB(jOi&acner9rNK~a8I kYH|sL6Q5X65Cb+uub}c4hfQvNN@-529V1ZNXCP((09&soB>(^b literal 0 HcmV?d00001 diff --git a/src/voiceproject-linux/voice_app/__pycache__/models.cpython-37.pyc b/src/voiceproject-linux/voice_app/__pycache__/models.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e98f0b121238e513c3066bffbe48dd1ec25eab0c GIT binary patch literal 162 zcmZ?b<>g`kg1Hg<6KsI=V-N=hn1BoiATAaF5-AKRj5!Rsj8Tk?3@J>(44TX@fuanW zjJMcw^HWlDiv2X1ZgHk$CFZ5)>!lS5h#Nmy!`>#x84-d=G(ka5$qA7KImhX~+qvv~q`T+7 znDu3S2$F}8CqczsLC}YY_#&9U!yv^=SoGpORIh8QcXc#!8c@+8a{lmzc=2RIsM0T+UL;xbiupF=vsC2yTUE3WfvY zH5j4>cuHdva9lBO5dH_yWN1=zMEV413uucPBeQRordX0TwFlr=Iwctpf~&ddB1J*6 zVDv5O>eZIsra!Ed7T9r0N0ibV2FPh0i+T$NYNa)>U{Qa}O?2#u&i7geIIUyfr(^%6 zGpv@V;mTSGNcvt$Xl22WQ>8}(w7X!?Dj@U0ldmyPYdd`4(lW1 zb>sbdKPW51V`YGzZ;-3gmkr=&M+Tg7svDhdNqzfWbb3q4ofV+7S#l0YmK&gZ(!Q2avzBS zs=bxP5zBd;%2qECUwq`=5MS zV39TUfBa$p)~EZQe{+wt?qZ7X*^ArZ)}FQf;i+QjA3UwECpp__EiW#&!i1h(ZV4I6 zIBJjOjaJ;aN7{Q&H(FtoQ5H4wC|MI{&h{8e8cQ(q#`5x+)2AEC9Y%HLV?d6+bmanw4cYAkV>OMwO2Jy3Lin;2 z03aUaMOl)BDecsbd|dk0;Ln27-(Q63A?cEBLX(;#jLx97FwfgtG20f4`7W=5W(9`0 z1d~B(@J2A6p#7Kg`kg1Hg<6F~H15CH>>K!yVl7qb9~6oz01O-8?!3`HPe1o6wj#VV#OKQlSC zpeR2pHMs=BiBBvjh{?@NFG?)Q%+D*1iI30B%PfhH*DI*J#bJ}1pHiBWY6mjuGY~TX E0Lf_}d;kCd literal 0 HcmV?d00001 diff --git a/src/voiceproject-linux/voice_app/models.py b/src/voiceproject-linux/voice_app/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/src/voiceproject-linux/voice_app/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/src/voiceproject-linux/voice_app/tests.py b/src/voiceproject-linux/voice_app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/src/voiceproject-linux/voice_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/src/voiceproject-linux/voice_app/views.py b/src/voiceproject-linux/voice_app/views.py new file mode 100644 index 0000000..9d93476 --- /dev/null +++ b/src/voiceproject-linux/voice_app/views.py @@ -0,0 +1,96 @@ +import os + +from django.http import HttpResponse +from django.shortcuts import render, redirect + + +# Create your views here. + +def upload(request): + if request.method == "POST": # 请求方法为POST时,进行处理 + username = request.POST.get('username') + myFile = request.FILES.get("file", None) # 获取上传的文件,如果没有文件,则默认为None + if not myFile: + return HttpResponse("no files for upload!") + + print(username) + print(myFile.name) + + traindir = "/home/wc/桌面/voiceprint-linux/dataset/audio" + "/" + username + predictdir = "/home/wc/桌面/voiceprint-linux/dataset/predict" + "/" + username + + isExists = os.path.exists(traindir) + if not isExists: + os.makedirs(traindir) + print(traindir + ' 创建成功') + else: + print(traindir + ' 已存在') + + isExists = os.path.exists(predictdir) + if not isExists: + os.makedirs(predictdir) + print(predictdir + ' 创建成功') + else: + print(predictdir + ' 已存在') + + files = os.listdir(predictdir) + length = len(files) + + myFilename = username + "-" + str(length + 1) + ".wav" + print(myFilename) + + destination = open(os.path.join(traindir, myFile.name), 'wb+') # 打开特定的文件进行二进制的写操作 + for chunk in myFile.chunks(): # 分块写入训练集文件 + destination.write(chunk) + destination.close() + command = "/home/wc/桌面/ffmpeg-4.4-amd64-static/ffmpeg -i " + traindir + "/" + myFile.name + " -acodec pcm_s16le -ac 2 -ar 44100 " + traindir + "/" + myFilename + print(command) + os.system(command) + + os.remove(traindir + "/" + myFile.name) + + destination2 = open(os.path.join(predictdir, myFile.name), 'wb+') # 打开特定的文件进行二进制的写操作 + for chunk in myFile.chunks(): # 分块写入预测集文件 + destination2.write(chunk) + destination2.close() + command = "/home/wc/桌面/ffmpeg-4.4-amd64-static/ffmpeg -i " + predictdir + "/" + myFile.name + " -acodec pcm_s16le -ac 2 -ar 44100 " + predictdir + "/" + myFilename + print(command) + os.system(command) + os.remove(predictdir + "/" + myFile.name) + + return redirect('upload') + else: + return render(request, 'upload.html') + + +def train_list(request): + if request.method == "POST": # 请求方法为POST时,进行处理 + username = request.POST.get('username') + command = "python /home/wc/桌面/voiceprint-linux/create_data.py" + " " + username + os.system(command) + return HttpResponse("训练已完成!") + #username = request.POST.get('username') + #command = "python C:\\Users\\Lenovo\\Desktop\\voiceprint-linux\\create_data.py" + " " + username + #os.system(command) + #return HttpResponse("训练已完成!") + else: + train_path = "/home/wc/桌面/voiceprint-linux/dataset/audio" + userlist = os.listdir(train_path) + print(userlist) + user_voicenum = {} + for i in range(len(userlist)): + username = userlist[i] + path = train_path + '/' + username + voicenum = len(os.listdir(path)) + print(voicenum) + user_voicenum[username] = voicenum + print(user_voicenum) + return render(request, 'train_list.html', {'user_voicenum': user_voicenum}) + + +def train(request, username): + command = "python /home/wc/桌面/voiceprint-linux/create_data.py" + " " + username + os.system(command) + return HttpResponse("训练已完成!") + + diff --git a/src/voiceproject-linux/voice_app/views.py~ b/src/voiceproject-linux/voice_app/views.py~ new file mode 100644 index 0000000..04964d6 --- /dev/null +++ b/src/voiceproject-linux/voice_app/views.py~ @@ -0,0 +1,93 @@ +import os + +from django.http import HttpResponse +from django.shortcuts import render, redirect + + +# Create your views here. + +def upload(request): + if request.method == "POST": # 请求方法为POST时,进行处理 + username = request.POST.get('username') + myFile = request.FILES.get("file", None) # 获取上传的文件,如果没有文件,则默认为None + if not myFile: + return HttpResponse("no files for upload!") + + print(username) + print(myFile.name) + + traindir = "/home/wc/桌面/voiceprint-linux/dataset/audio" + "/" + username + predictdir = "/home/wc/桌面/voiceprint-linux/dataset/predict" + "/" + username + + isExists = os.path.exists(traindir) + if not isExists: + os.makedirs(traindir) + print(traindir + ' 创建成功') + else: + print(traindir + ' 已存在') + + isExists = os.path.exists(predictdir) + if not isExists: + os.makedirs(predictdir) + print(predictdir + ' 创建成功') + else: + print(predictdir + ' 已存在') + + files = os.listdir(predictdir) + length = len(files) + + myFilename = username + "-" + str(length + 1) + ".wav" + print(myFilename) + + destination = open(os.path.join(traindir, myFile.name), 'wb+') # 打开特定的文件进行二进制的写操作 + for chunk in myFile.chunks(): # 分块写入训练集文件 + destination.write(chunk) + destination.close() + command = "/home/wc/桌面/ffmpeg-4.4-amd64-static/ffmpeg -i " + traindir + "/" + myFile.name + " -acodec pcm_s16le -ac 2 -ar 44100 " + traindir + "/" + myFilename + print(command) + os.system(command) + + os.remove(traindir + "/" + myFile.name) + + destination2 = open(os.path.join(predictdir, myFile.name), 'wb+') # 打开特定的文件进行二进制的写操作 + for chunk in myFile.chunks(): # 分块写入预测集文件 + destination2.write(chunk) + destination2.close() + command = "/home/wc/桌面/ffmpeg-4.4-amd64-static/ffmpeg -i " + predictdir + "/" + myFile.name + " -acodec pcm_s16le -ac 2 -ar 44100 " + predictdir + "/" + myFilename + print(command) + os.system(command) + os.remove(predictdir + "/" + myFile.name) + + return redirect('upload') + else: + return render(request, 'upload.html') + + +def train_list(request): + if request.method == "POST": # 请求方法为POST时,进行处理 + return render(request, 'train_list.html') + #username = request.POST.get('username') + #command = "python C:\\Users\\Lenovo\\Desktop\\voiceprint-linux\\create_data.py" + " " + username + #os.system(command) + #return HttpResponse("训练已完成!") + else: + train_path = "/home/wc/桌面/voiceprint-linux/dataset/audio" + userlist = os.listdir(train_path) + print(userlist) + user_voicenum = {} + for i in range(len(userlist)): + username = userlist[i] + path = train_path + '/' + username + voicenum = len(os.listdir(path)) + print(voicenum) + user_voicenum[username] = voicenum + print(user_voicenum) + return render(request, 'train_list.html', {'user_voicenum': user_voicenum}) + + +def train(request, username): + command = "python /home/wc/桌面/voiceprint-linux/create_data.py" + " " + username + os.system(command) + return HttpResponse("训练已完成!") + + diff --git a/src/voiceproject-linux/voiceproject/__init__.py b/src/voiceproject-linux/voiceproject/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/voiceproject-linux/voiceproject/__pycache__/__init__.cpython-37.pyc b/src/voiceproject-linux/voiceproject/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1eafbb537c2d2534af69633cd7d73d07c661baf0 GIT binary patch literal 127 zcmZ?b<>g`kg20IV2_X70h=2h`Aj1KOi&=m~3PUi1CZpdRqgx>?XAoh*}z^v5%MJ)?iI0e&?gBdstv+b023eLb;I0xt90$hYk$eD)AS`Mxdp*!>TG)ckLck#9W zQ*aGFf$Q)oeAX7J0Qom!ThM0VhIR%%hdI={c`XLF-o&Y(orQV0jXLviCz=b9gIDqFJ zl5h1bD{oQ8^KR>CSB3-Vh)~>{Vf6|7KfXND8guj>t0Gn}2!Xh1@Q#1q>AFixFIR8O z-C_&&6RR`-s`H4J=355m_!}MA&uFq1KyZb;kXkl3fpz0a`gHSRpzy%GEO^`?2oBFnux`~ERM$^ z;~Eo4&8TL_3@0}+%GtQ_#vqSlRu4b235%L9x`z1z`$qcisb|=v(F+@djoFf$xmvAs+T()E~sXA5BUwQVQfqSgxl*raVx_vJ25EV7 zQ;(=rW3yRp)K&lb2kF~qZ7N~iV&bDy4N^c_M&IIx^$vSS*<>#*%E_{yMdpw$#Dk<# zU$54cK&;CfiWh!S{AUxiAT-j2vfva>@zK~-7Nd*B7P#U zg^Go%K}y&0cGvYF?y?}&!)w%{dtMy#7o>GPyjf6|@(6RSS0qUG@Gfz_)XxsVTeimJ&>F zH5yHQd#hG%)Sm`o=spm;E_H%TQ`y+8$xTHKW_Q)~YG_-lmgTU1f=oqj%3%m+9R{x}ujG6$JsS8;Y(qutw6`7<{#~QXf#Y(o#K0 zhPem@5KVu7g;cTQ+N8K|7XNzp)BB%)EshuQqD7tl>kn9mA1bML z5Tw7hUFcinn^OqHc5o7fv@o5RO^FFHKAnsUMxx!E2 z0OG=*;l^dJNJ#ww+!?zY5s;AT)mk&-@ys`$XP%Bm5rVb-<@?FEHbOs~vR*w99>Z_u zurV}4EMTo75Up7&aB{n7i*OctIV?J&JL?9BhpfX}tF2Yi6i}gOVLF{{{7I$+;gUQ^?h&iXJTt^O6G(4J^z4EPh-IeHQ6)2n?k24ddN09G7{gTJ zT$D=NDaLcH1QwSmEz8EZ;eWsJ_a#FC8x_J;D0aCsnd~-oEtTNASW>|sO`JT5qr-w4 zvv&%Gv5lzzL!s=FYX>CpM6KaGhgcr{EzvmtgqqX^*@^!_bS$%?V!2!Z2|k}IErZ8g z^KH?W9I^w<-%onR9XcUk$9LxlCOTk~;dMT;26D**8{CD+8Sh z-Up=ac=OA6RBxpzbX=Ow#!ZpHjn(<7h9N-pV54#k(~0W7pA7eCI&^wya?9(`QKP$H z&~9dR-yID$y5}p>cie&7em#VZxQ-#`8Tt9?{q@JsWOLy5id>( zRWJ*DY$#eZW{rSAux#G9L{qdj)K`r=GCLA^Ga@8nin8gn)0$#GUHaF zPE(Kf)>9Q&0h8LZ7TX3x?ZKsCbE)7NGXUYj+R~iHvB1nkV##%mdrcV@G3fYJ^fF%H zmBm;kl{}H@6JbqaWc7_PKTqxB>6Dze|mp; z`{Zy1kpXL^&P}iF+DYPdB#EPF+~b{^DD#hqYV3-7HrEEdmKACj`auD6zEajbIH3Jb os`@*(?$6Wy>DNQH|BD(mDsNop^=`LsI)2d9u1P!eA$>&u0-%bjRsaA1 literal 0 HcmV?d00001 diff --git a/src/voiceproject-linux/voiceproject/asgi.py b/src/voiceproject-linux/voiceproject/asgi.py new file mode 100644 index 0000000..050c256 --- /dev/null +++ b/src/voiceproject-linux/voiceproject/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for voiceproject project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'voiceproject.settings') + +application = get_asgi_application() diff --git a/src/voiceproject-linux/voiceproject/settings.py b/src/voiceproject-linux/voiceproject/settings.py new file mode 100644 index 0000000..c99ce2c --- /dev/null +++ b/src/voiceproject-linux/voiceproject/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for voiceproject project. + +Generated by 'django-admin startproject' using Django 3.1.5. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.1/ref/settings/ +""" +import os +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'njo00q@!#%s+m=lh&vh7i1&fhr8t3ck4nf=1nh*r)z$+#)t@_i' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = ['192.168.8.148', 'localhost', '0.0.0.0:8000', '127.0.0.1'] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'voice_app', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'voiceproject.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'voiceproject.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.1/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/src/voiceproject-linux/voiceproject/settings.py~ b/src/voiceproject-linux/voiceproject/settings.py~ new file mode 100644 index 0000000..dfe9049 --- /dev/null +++ b/src/voiceproject-linux/voiceproject/settings.py~ @@ -0,0 +1,121 @@ +""" +Django settings for voiceproject project. + +Generated by 'django-admin startproject' using Django 3.1.5. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.1/ref/settings/ +""" +import os +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'njo00q@!#%s+m=lh&vh7i1&fhr8t3ck4nf=1nh*r)z$+#)t@_i' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = ['192.168.42.138', 'localhost', '0.0.0.0:8000', '127.0.0.1'] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'voice_app', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'voiceproject.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'voiceproject.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.1/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/src/voiceproject-linux/voiceproject/urls.py b/src/voiceproject-linux/voiceproject/urls.py new file mode 100644 index 0000000..2fdeeb0 --- /dev/null +++ b/src/voiceproject-linux/voiceproject/urls.py @@ -0,0 +1,25 @@ +"""voiceproject URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path +from voice_app import views + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', views.upload, name='upload'), + path('train_list/', views.train_list, name='train_list'), + path('train//', views.train, name='train'), +] diff --git a/src/voiceproject-linux/voiceproject/urls.py~ b/src/voiceproject-linux/voiceproject/urls.py~ new file mode 100644 index 0000000..f045096 --- /dev/null +++ b/src/voiceproject-linux/voiceproject/urls.py~ @@ -0,0 +1,25 @@ +"""voiceproject URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path +from voice_app import views + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', views.upload, name='upload'), + path('train_list/', views.train_list, name='train_list'), + +] diff --git a/src/voiceproject-linux/voiceproject/wsgi.py b/src/voiceproject-linux/voiceproject/wsgi.py new file mode 100644 index 0000000..89f7b54 --- /dev/null +++ b/src/voiceproject-linux/voiceproject/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for voiceproject project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'voiceproject.settings') + +application = get_wsgi_application()