Yoonjunhyeon

threshold 추가 및 env 변경 (python3.7.7 사용)

1 +# Generated by Django 3.0.5 on 2020-05-31 05:39
2 +
3 +from django.db import migrations, models
4 +
5 +
6 +class Migration(migrations.Migration):
7 +
8 + dependencies = [
9 + ('api', '0001_initial'),
10 + ]
11 +
12 + operations = [
13 + migrations.AddField(
14 + model_name='video',
15 + name='threshold',
16 + field=models.CharField(default=20, max_length=20),
17 + preserve_default=False,
18 + ),
19 + ]
...@@ -6,6 +6,7 @@ from api import file_upload_path_for_db ...@@ -6,6 +6,7 @@ from api import file_upload_path_for_db
6 class Video(models.Model): 6 class Video(models.Model):
7 videourl = models.CharField(max_length=1000, blank=True) 7 videourl = models.CharField(max_length=1000, blank=True)
8 title = models.CharField(max_length=200) 8 title = models.CharField(max_length=200)
9 + threshold = models.CharField(max_length=20)
9 tags = models.CharField(max_length=500) 10 tags = models.CharField(max_length=500)
10 11
11 12
......
...@@ -55,6 +55,7 @@ class VideoFileUploadView(APIView): ...@@ -55,6 +55,7 @@ class VideoFileUploadView(APIView):
55 55
56 # 요청된 파일 객체 56 # 요청된 파일 객체
57 file_name = req.data['file'] 57 file_name = req.data['file']
58 + threshold = req.data['threshold']
58 59
59 # 저장될 파일의 풀path를 생성 60 # 저장될 파일의 풀path를 생성
60 new_file_full_name = file_upload_path(file_name.name) 61 new_file_full_name = file_upload_path(file_name.name)
......
1 # This file must be used with "source bin/activate" *from bash* 1 # This file must be used with "source bin/activate" *from bash*
2 # you cannot run it directly 2 # you cannot run it directly
3 3
4 +
5 +if [ "${BASH_SOURCE-}" = "$0" ]; then
6 + echo "You must source this script: \$ source $0" >&2
7 + exit 33
8 +fi
9 +
4 deactivate () { 10 deactivate () {
11 + unset -f pydoc >/dev/null 2>&1
12 +
5 # reset old environment variables 13 # reset old environment variables
6 - if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then 14 + # ! [ -z ${VAR+_} ] returns true if VAR is declared at all
7 - PATH="${_OLD_VIRTUAL_PATH:-}" 15 + if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then
16 + PATH="$_OLD_VIRTUAL_PATH"
8 export PATH 17 export PATH
9 unset _OLD_VIRTUAL_PATH 18 unset _OLD_VIRTUAL_PATH
10 fi 19 fi
11 - if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then 20 + if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
12 - PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" 21 + PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
13 export PYTHONHOME 22 export PYTHONHOME
14 unset _OLD_VIRTUAL_PYTHONHOME 23 unset _OLD_VIRTUAL_PYTHONHOME
15 fi 24 fi
...@@ -17,18 +26,18 @@ deactivate () { ...@@ -17,18 +26,18 @@ deactivate () {
17 # This should detect bash and zsh, which have a hash command that must 26 # This should detect bash and zsh, which have a hash command that must
18 # be called to get it to forget past commands. Without forgetting 27 # be called to get it to forget past commands. Without forgetting
19 # past commands the $PATH changes we made may not be respected 28 # past commands the $PATH changes we made may not be respected
20 - if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then 29 + if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
21 - hash -r 30 + hash -r 2>/dev/null
22 fi 31 fi
23 32
24 - if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then 33 + if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
25 - PS1="${_OLD_VIRTUAL_PS1:-}" 34 + PS1="$_OLD_VIRTUAL_PS1"
26 export PS1 35 export PS1
27 unset _OLD_VIRTUAL_PS1 36 unset _OLD_VIRTUAL_PS1
28 fi 37 fi
29 38
30 unset VIRTUAL_ENV 39 unset VIRTUAL_ENV
31 - if [ ! "${1:-}" = "nondestructive" ] ; then 40 + if [ ! "${1-}" = "nondestructive" ] ; then
32 # Self destruct! 41 # Self destruct!
33 unset -f deactivate 42 unset -f deactivate
34 fi 43 fi
...@@ -37,7 +46,7 @@ deactivate () { ...@@ -37,7 +46,7 @@ deactivate () {
37 # unset irrelevant variables 46 # unset irrelevant variables
38 deactivate nondestructive 47 deactivate nondestructive
39 48
40 -VIRTUAL_ENV="/home/jun/documents/univ/PKH_Project1/web/backend/env" 49 +VIRTUAL_ENV='/home/jun/documents/univ/PKH_Project1/web/backend/env'
41 export VIRTUAL_ENV 50 export VIRTUAL_ENV
42 51
43 _OLD_VIRTUAL_PATH="$PATH" 52 _OLD_VIRTUAL_PATH="$PATH"
...@@ -45,32 +54,31 @@ PATH="$VIRTUAL_ENV/bin:$PATH" ...@@ -45,32 +54,31 @@ PATH="$VIRTUAL_ENV/bin:$PATH"
45 export PATH 54 export PATH
46 55
47 # unset PYTHONHOME if set 56 # unset PYTHONHOME if set
48 -# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) 57 +if ! [ -z "${PYTHONHOME+_}" ] ; then
49 -# could use `if (set -u; : $PYTHONHOME) ;` in bash 58 + _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
50 -if [ -n "${PYTHONHOME:-}" ] ; then
51 - _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
52 unset PYTHONHOME 59 unset PYTHONHOME
53 fi 60 fi
54 61
55 -if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then 62 +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
56 - _OLD_VIRTUAL_PS1="${PS1:-}" 63 + _OLD_VIRTUAL_PS1="${PS1-}"
57 - if [ "x(env) " != x ] ; then 64 + if [ "x" != x ] ; then
58 - PS1="(env) ${PS1:-}" 65 + PS1="${PS1-}"
59 - else
60 - if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
61 - # special case for Aspen magic directories
62 - # see http://www.zetadev.com/software/aspen/
63 - PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
64 else 66 else
65 - PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" 67 + PS1="(`basename \"$VIRTUAL_ENV\"`) ${PS1-}"
66 - fi
67 fi 68 fi
68 export PS1 69 export PS1
69 fi 70 fi
70 71
72 +# Make sure to unalias pydoc if it's already there
73 +alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true
74 +
75 +pydoc () {
76 + python -m pydoc "$@"
77 +}
78 +
71 # This should detect bash and zsh, which have a hash command that must 79 # This should detect bash and zsh, which have a hash command that must
72 # be called to get it to forget past commands. Without forgetting 80 # be called to get it to forget past commands. Without forgetting
73 # past commands the $PATH changes we made may not be respected 81 # past commands the $PATH changes we made may not be respected
74 -if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then 82 +if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
75 - hash -r 83 + hash -r 2>/dev/null
76 fi 84 fi
......
1 # This file must be used with "source bin/activate.csh" *from csh*. 1 # This file must be used with "source bin/activate.csh" *from csh*.
2 # You cannot run it directly. 2 # You cannot run it directly.
3 # Created by Davide Di Blasi <davidedb@gmail.com>. 3 # Created by Davide Di Blasi <davidedb@gmail.com>.
4 -# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
5 4
6 -alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate' 5 +set newline='\
6 +'
7 +
8 +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH:q" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT:q" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
7 9
8 # Unset irrelevant variables. 10 # Unset irrelevant variables.
9 deactivate nondestructive 11 deactivate nondestructive
10 12
11 -setenv VIRTUAL_ENV "/home/jun/documents/univ/PKH_Project1/web/backend/env" 13 +setenv VIRTUAL_ENV '/home/jun/documents/univ/PKH_Project1/web/backend/env'
14 +
15 +set _OLD_VIRTUAL_PATH="$PATH:q"
16 +setenv PATH "$VIRTUAL_ENV:q/bin:$PATH:q"
12 17
13 -set _OLD_VIRTUAL_PATH="$PATH"
14 -setenv PATH "$VIRTUAL_ENV/bin:$PATH"
15 18
16 19
17 -set _OLD_VIRTUAL_PROMPT="$prompt" 20 +if ('' != "") then
21 + set env_name = ''
22 +else
23 + set env_name = '('"$VIRTUAL_ENV:t:q"') '
24 +endif
18 25
19 -if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then 26 +if ( $?VIRTUAL_ENV_DISABLE_PROMPT ) then
20 - if ("env" != "") then 27 + if ( $VIRTUAL_ENV_DISABLE_PROMPT == "" ) then
21 - set env_name = "env" 28 + set do_prompt = "1"
22 else 29 else
23 - if (`basename "VIRTUAL_ENV"` == "__") then 30 + set do_prompt = "0"
24 - # special case for Aspen magic directories 31 + endif
25 - # see http://www.zetadev.com/software/aspen/ 32 +else
26 - set env_name = `basename \`dirname "$VIRTUAL_ENV"\`` 33 + set do_prompt = "1"
34 +endif
35 +
36 +if ( $do_prompt == "1" ) then
37 + # Could be in a non-interactive environment,
38 + # in which case, $prompt is undefined and we wouldn't
39 + # care about the prompt anyway.
40 + if ( $?prompt ) then
41 + set _OLD_VIRTUAL_PROMPT="$prompt:q"
42 + if ( "$prompt:q" =~ *"$newline:q"* ) then
43 + :
27 else 44 else
28 - set env_name = `basename "$VIRTUAL_ENV"` 45 + set prompt = "$env_name:q$prompt:q"
29 endif 46 endif
30 endif 47 endif
31 - set prompt = "[$env_name] $prompt"
32 - unset env_name
33 endif 48 endif
34 49
50 +unset env_name
51 +unset do_prompt
52 +
35 alias pydoc python -m pydoc 53 alias pydoc python -m pydoc
36 54
37 rehash 55 rehash
......
1 -# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org) 1 +# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
2 -# you cannot run it directly 2 +# Do not run it directly.
3 3
4 -function deactivate -d "Exit virtualenv and return to normal shell environment" 4 +function _bashify_path -d "Converts a fish path to something bash can recognize"
5 + set fishy_path $argv
6 + set bashy_path $fishy_path[1]
7 + for path_part in $fishy_path[2..-1]
8 + set bashy_path "$bashy_path:$path_part"
9 + end
10 + echo $bashy_path
11 +end
12 +
13 +function _fishify_path -d "Converts a bash path to something fish can recognize"
14 + echo $argv | tr ':' '\n'
15 +end
16 +
17 +function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
5 # reset old environment variables 18 # reset old environment variables
6 if test -n "$_OLD_VIRTUAL_PATH" 19 if test -n "$_OLD_VIRTUAL_PATH"
7 - set -gx PATH $_OLD_VIRTUAL_PATH 20 + # https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
21 + if test (echo $FISH_VERSION | head -c 1) -lt 3
22 + set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH")
23 + else
24 + set -gx PATH "$_OLD_VIRTUAL_PATH"
25 + end
8 set -e _OLD_VIRTUAL_PATH 26 set -e _OLD_VIRTUAL_PATH
9 end 27 end
28 +
10 if test -n "$_OLD_VIRTUAL_PYTHONHOME" 29 if test -n "$_OLD_VIRTUAL_PYTHONHOME"
11 - set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME 30 + set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME"
12 set -e _OLD_VIRTUAL_PYTHONHOME 31 set -e _OLD_VIRTUAL_PYTHONHOME
13 end 32 end
14 33
15 if test -n "$_OLD_FISH_PROMPT_OVERRIDE" 34 if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
35 + and functions -q _old_fish_prompt
36 + # Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
37 + set -l fish_function_path
38 +
39 + # Erase virtualenv's `fish_prompt` and restore the original.
16 functions -e fish_prompt 40 functions -e fish_prompt
17 - set -e _OLD_FISH_PROMPT_OVERRIDE
18 functions -c _old_fish_prompt fish_prompt 41 functions -c _old_fish_prompt fish_prompt
19 functions -e _old_fish_prompt 42 functions -e _old_fish_prompt
43 + set -e _OLD_FISH_PROMPT_OVERRIDE
20 end 44 end
21 45
22 set -e VIRTUAL_ENV 46 set -e VIRTUAL_ENV
23 - if test "$argv[1]" != "nondestructive" 47 +
24 - # Self destruct! 48 + if test "$argv[1]" != 'nondestructive'
49 + # Self-destruct!
50 + functions -e pydoc
25 functions -e deactivate 51 functions -e deactivate
52 + functions -e _bashify_path
53 + functions -e _fishify_path
26 end 54 end
27 end 55 end
28 56
29 -# unset irrelevant variables 57 +# Unset irrelevant variables.
30 deactivate nondestructive 58 deactivate nondestructive
31 59
32 -set -gx VIRTUAL_ENV "/home/jun/documents/univ/PKH_Project1/web/backend/env" 60 +set -gx VIRTUAL_ENV '/home/jun/documents/univ/PKH_Project1/web/backend/env'
33 61
34 -set -gx _OLD_VIRTUAL_PATH $PATH 62 +# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
35 -set -gx PATH "$VIRTUAL_ENV/bin" $PATH 63 +if test (echo $FISH_VERSION | head -c 1) -lt 3
64 + set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH)
65 +else
66 + set -gx _OLD_VIRTUAL_PATH "$PATH"
67 +end
68 +set -gx PATH "$VIRTUAL_ENV"'/bin' $PATH
36 69
37 -# unset PYTHONHOME if set 70 +# Unset `$PYTHONHOME` if set.
38 if set -q PYTHONHOME 71 if set -q PYTHONHOME
39 set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME 72 set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
40 set -e PYTHONHOME 73 set -e PYTHONHOME
41 end 74 end
42 75
43 -if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" 76 +function pydoc
44 - # fish uses a function instead of an env var to generate the prompt. 77 + python -m pydoc $argv
78 +end
45 79
46 - # save the current fish_prompt function as the function _old_fish_prompt 80 +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
81 + # Copy the current `fish_prompt` function as `_old_fish_prompt`.
47 functions -c fish_prompt _old_fish_prompt 82 functions -c fish_prompt _old_fish_prompt
48 83
49 - # with the original prompt function renamed, we can override with our own.
50 function fish_prompt 84 function fish_prompt
51 - # Save the return status of the last command 85 + # Run the user's prompt first; it might depend on (pipe)status.
52 - set -l old_status $status 86 + set -l prompt (_old_fish_prompt)
53 87
54 - # Prompt override? 88 + # Prompt override provided?
55 - if test -n "(env) " 89 + # If not, just prepend the environment name.
56 - printf "%s%s" "(env) " (set_color normal) 90 + if test -n ''
91 + printf '%s%s' '' (set_color normal)
57 else 92 else
58 - # ...Otherwise, prepend env 93 + printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV")
59 - set -l _checkbase (basename "$VIRTUAL_ENV")
60 - if test $_checkbase = "__"
61 - # special case for Aspen magic directories
62 - # see http://www.zetadev.com/software/aspen/
63 - printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal)
64 - else
65 - printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal)
66 - end
67 end 94 end
68 95
69 - # Restore the return status of the previous command. 96 + string join -- \n $prompt # handle multi-line prompts
70 - echo "exit $old_status" | .
71 - _old_fish_prompt
72 end 97 end
73 98
74 set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" 99 set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
......
1 -/usr/bin/python
...\ No newline at end of file ...\ No newline at end of file
1 +/usr/local/bin/python3.7
...\ No newline at end of file ...\ No newline at end of file
......
1 -lib
...\ No newline at end of file ...\ No newline at end of file
1 -home = /usr/bin 1 +home = /usr/local
2 +implementation = CPython
3 +version_info = 3.7.7.final.0
4 +virtualenv = 20.0.21
2 include-system-site-packages = false 5 include-system-site-packages = false
3 -version = 3.8.2 6 +base-prefix = /usr/local
7 +base-exec-prefix = /usr/local
8 +base-executable = /usr/local/bin/python3.7
......
1 Django==3.0.5 1 Django==3.0.5
2 django-cors-headers==3.2.1 2 django-cors-headers==3.2.1
3 djangorestframework==3.11.0 3 djangorestframework==3.11.0
4 +tensorflow==1.15
5 +pandas==1.0.4
6 +gensim==3.8.3
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -13,3 +13,5 @@ GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/youtube8m/extract_yt8m_f ...@@ -13,3 +13,5 @@ GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/youtube8m/extract_yt8m_f
13 --calculator_graph_config_file=mediapipe/graphs/youtube8m/feature_extraction.pbtxt \ 13 --calculator_graph_config_file=mediapipe/graphs/youtube8m/feature_extraction.pbtxt \
14 --input_side_packets=input_sequence_example=/tmp/mediapipe/metadata.pb \ 14 --input_side_packets=input_sequence_example=/tmp/mediapipe/metadata.pb \
15 --output_side_packets=output_sequence_example=/tmp/mediapipe/features.pb 15 --output_side_packets=output_sequence_example=/tmp/mediapipe/features.pb
16 +
17 +mv /tmp/mediapipe/features.pb ./features.pb
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -157,7 +157,7 @@ def inference_pb(file_path, model_path): ...@@ -157,7 +157,7 @@ def inference_pb(file_path, model_path):
157 if __name__ == '__main__': 157 if __name__ == '__main__':
158 logging.set_verbosity(tf.logging.INFO) 158 logging.set_verbosity(tf.logging.INFO)
159 159
160 - file_path = 'features.pb' 160 + file_path = '/tmp/mediapipe/features.pb'
161 model_path = '/Users/esot3ria/PycharmProjects/yt8m/models/frame' \ 161 model_path = '/Users/esot3ria/PycharmProjects/yt8m/models/frame' \
162 '/sample_model/inference_model/segment_inference_model' 162 '/sample_model/inference_model/segment_inference_model'
163 163
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 <v-overlay v-model="loadingProcess"> 3 <v-overlay v-model="loadingProcess">
4 <v-progress-circular :size="120" width="10" color="primary" indeterminate></v-progress-circular> 4 <v-progress-circular :size="120" width="10" color="primary" indeterminate></v-progress-circular>
5 <div 5 <div
6 - style="color: #ffffff; font-size: 22px; margin-top: 20px; margin-left: -30px;" 6 + style="color: #ffffff; font-size: 22px; margin-top: 20px; margin-left: -40px;"
7 >Analyzing Your Video...</div> 7 >Analyzing Your Video...</div>
8 </v-overlay> 8 </v-overlay>
9 <v-layout justify-center> 9 <v-layout justify-center>
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
85 <div>recommended Youtube link</div> 85 <div>recommended Youtube link</div>
86 </div> 86 </div>
87 <v-row justify="center" class="mx-12"> 87 <v-row justify="center" class="mx-12">
88 - <v-slider v-model="slider" :thumb-size="20" thumb-label="always" :min="20" :max="80" ></v-slider> 88 + <v-slider v-model="threshold" :thumb-size="20" thumb-label="always" :min="20" :max="80" ></v-slider>
89 </v-row> 89 </v-row>
90 <div 90 <div
91 style="font-size: 24px; text-align: center; font-weight: 400; color: #5a5a5a;" 91 style="font-size: 24px; text-align: center; font-weight: 400; color: #5a5a5a;"
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
103 <div 103 <div
104 style="margin-left: 5px; margin-top: -18px; background-color: #fff; width: 140px; text-align: center;font-size: 14px; color: #5a5a5a; font-weight: 500" 104 style="margin-left: 5px; margin-top: -18px; background-color: #fff; width: 140px; text-align: center;font-size: 14px; color: #5a5a5a; font-weight: 500"
105 >Related Youtube Link</div> 105 >Related Youtube Link</div>
106 - <v-flex v-for="(url) in YoutubeUrl" :key="url"> 106 + <v-flex v-for="(url) in YoutubeUrl" :key="url.id">
107 <div> 107 <div>
108 <a :href="url">{{url}}</a> 108 <a :href="url">{{url}}</a>
109 </div> 109 </div>
......