html test uploader
This commit is contained in:
@ -25,7 +25,7 @@ SECRET_KEY = 'django-insecure-#-a9k=#&y3e&a&@%rn7mhl@fk3smxceqh^@1)#9t@c-qzx&k^b
|
|||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['aiworks.intranet.sumasen.net',]
|
ALLOWED_HOSTS = ['aiworks.intranet.sumasen.net', 'localhost']
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
@ -56,7 +56,7 @@ ROOT_URLCONF = 'ocr.urls'
|
|||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [],
|
'DIRS': [BASE_DIR / 'templates'],
|
||||||
'APP_DIRS': True,
|
'APP_DIRS': True,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'context_processors': [
|
'context_processors': [
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, re_path
|
from django.urls import path, re_path
|
||||||
from .views import FileUploadView
|
from .views import FileUploadView, UploaderView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
re_path(r'^upload/', FileUploadView.as_view())
|
re_path(r'^upload/', FileUploadView.as_view()),
|
||||||
|
path('uploader/', UploaderView, name="uploader")
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.parsers import MultiPartParser
|
from rest_framework.parsers import MultiPartParser
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
import easyocr
|
import easyocr
|
||||||
|
|
||||||
|
def UploaderView(request):
|
||||||
|
return render(request, 'sumasen_easyocr/index.html')
|
||||||
|
|
||||||
class FileUploadView(APIView):
|
class FileUploadView(APIView):
|
||||||
parser_classes = [MultiPartParser,]
|
parser_classes = [MultiPartParser,]
|
||||||
|
|
||||||
|
|||||||
23
templates/sumasen_easyocr/index.html
Normal file
23
templates/sumasen_easyocr/index.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
html {
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h2>Sumase OCR file upload test</h2>
|
||||||
|
<form action="http://aiworks.intranet.sumasen.net:8600/api/v1/upload/" method="post" enctype="multipart/form-data">
|
||||||
|
<input type="file" name="file" id="file_to_upload">
|
||||||
|
<hr>
|
||||||
|
<input type="submit" value="Upload To Server" id="upload_file_button">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user