diff --git a/myproject/myapp/templates/_base.html b/myproject/myapp/templates/_base.html index 2f934a25e7a9f2df2e633520b35590c7e0a22142..1c7aff007ef2627b40a3ee484e0dd453d72aaad4 100644 --- a/myproject/myapp/templates/_base.html +++ b/myproject/myapp/templates/_base.html @@ -144,7 +144,7 @@ <span class="text-sm text-gray-500 sm:text-center dark:text-gray-400">© 2024 <a href="https://flowbite.com/" class="hover:underline">DESD Group 25</a>. All Rights Reserved. </span> </div> -</footer> +</footer> </html> diff --git a/myproject/myapp/templates/index.html b/myproject/myapp/templates/index1.html similarity index 57% rename from myproject/myapp/templates/index.html rename to myproject/myapp/templates/index1.html index 0b0679db8009c97c32a59b800bd1e1b2ee0f1b6b..2f1c6636b26e0d772ebfed9122f94de476c5ca7e 100644 --- a/myproject/myapp/templates/index.html +++ b/myproject/myapp/templates/index1.html @@ -16,9 +16,20 @@ <img class="w-240 h-60 rounded-lg" src="{% static 'src/images/0_IPKn3dedq86U4UqP.png' %}" alt="CNN for audio"> </div> </div> - <div class="gap-16 items-center py-8 px-4 mx-auto max-w-screen-xl lg:grid lg:grid-cols-2 lg:py-16 lg:px-6"> - <input class="block w-full text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 dark:text-gray-400 focus:outline-none dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400" id="file_input" type="file"> - <button type="button" class="text-white bg-gray-800 hover:bg-gray-900 focus:outline-none focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:border-gray-700">Run Algorithm</button> + <div > + <form enctype="multipart/form-data" method="post" class="gap-16 items-center py-8 px-4 mx-auto max-w-screen-xl lg:grid lg:grid-cols-2 lg:py-16 lg:px-6"> + {% csrf_token %} + <input + class="block w-full text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 dark:text-gray-400 focus:outline-none dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400" + id="audio_file" + name="audio_file" + type="file"> + + + <button type="submit" class="text-white bg-gray-800 hover:bg-gray-900 focus:outline-none focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:border-gray-700"> + Run Algorithm + </button> + </form> </div> </section> diff --git a/myproject/myapp/templates/index2.html b/myproject/myapp/templates/index2.html new file mode 100644 index 0000000000000000000000000000000000000000..7cf84cd548c3d740ac54daec2b96a4fb952fd440 --- /dev/null +++ b/myproject/myapp/templates/index2.html @@ -0,0 +1,41 @@ +{% extends "_base.html" %} + +{% block content %} + <section class="bg-white dark:bg-gray-900"> + <div class="gap-16 items-center py-8 px-4 mx-auto max-w-screen-xl lg:grid lg:grid-cols-2 lg:py-16 lg:px-6"> + <div class="font-light text-gray-500 sm:text-lg dark:text-gray-400"> + <h2 class="mb-4 text-4xl tracking-tight font-extrabold text-gray-900 dark:text-white">An Intelligent System for Instrument Detection</h2> + <p class="mb-4">*placeholder input* We present to you a intelligent system for instrument detection. Using audio processing techinques and a convolutionsal + neural network we are able to classify instruments used in a song. other exciting words that might catch peoples attention and make them use our product. + To use our service upload an mp3 file below. + *placeholder input* + </p> + </div> + <div class="grid gap-4 mt-8"> + {% load static %} + <img class="w-240 h-60 rounded-lg" src="{% static 'src/images/0_IPKn3dedq86U4UqP.png' %}" alt="CNN for audio"> + </div> + </div> + <section class="bg-white dark:bg-gray-900"> + <div class="py-8 px-4 mx-auto max-w-screen-xl text-center lg:py-16 lg:px-6"> + <div class="mx-auto max-w-screen-sm"> + <h2 class="mb-4 text-4xl tracking-tight font-extrabold text-gray-900 dark:text-white"> + Want use to our service? + </h2> + <p class="mb-8 font-light text-gray-500 lg:mb-16 sm:text-xl dark:text-gray-400"> + <a href="{% url 'register' %}" class="inline-flex items-center font-medium text-primary-600 hover:text-primary-800 dark:text-primary-500 dark:hover:text-primary-700">Sign up</a> + or <a href="{% url 'login' %}" class="inline-flex items-center font-medium text-primary-600 hover:text-primary-800 dark:text-primary-500 dark:hover:text-primary-700">Login!</a> + Choose one of our exceptionally well priced payment offers and enjoy our service to it's fullest! + </p> + </div> + </div> + </section> +{% comment %} <section class="bg-white dark:bg-gray-900"> + <div class="gap-4 items-center py-8 px-4 mx-auto max-w-screen-xl lg:grid lg:grid-cols-2 lg:py-16 lg:px-6 cursor-not-allowed"> + <input class="block w-full text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 dark:text-gray-400 focus:outline-none dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 cursor-not-allowed" id="file_input" type="file" disabled> + <button type="button" class="text-white bg-gray-800 focus:outline-none focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-gray-800 dark:focus:ring-gray-700 dark:border-gray-700 cursor-not-allowed" disabled>Run Algorithm</button> + </div> {% endcomment %} +</section> + + +{% endblock content %} \ No newline at end of file diff --git a/myproject/myapp/views.py b/myproject/myapp/views.py index d5b44c2e10259840fe4611696d27f71b425086de..0854a991a226e8cba5e99449c2dc86a162413812 100644 --- a/myproject/myapp/views.py +++ b/myproject/myapp/views.py @@ -2,8 +2,21 @@ from django.shortcuts import render from django.template import RequestContext def index(request): - return render(request, 'index.html') - + + if request.method == 'POST': + if request.FILES['audio_file'] != None: + uploaded_file = request.FILES['audio_file'] + # Do something with the uploaded file + return render(request, 'index1.html') + else: + return render(request, 'index1.html') + # if request.user.is_authenticated: + # return render(request, 'index1.html') + # else: + # return render(request, 'index1.html') + + + def users(request): return render(request, 'user_page.html')