프로젝트

일반

사용자정보

개정판 c64be242

IDc64be242b893788965eca6f8dea6999a92282326
상위 60998ab9
하위 ee11a3c6

함의성이(가) 약 5년 전에 추가함

issue #1366: fix path

Change-Id: I2ec81696a73fbc8ffb1b96e2c3289f33f507aebd

차이점 보기:

DTI_PID/WebServer/app.py
3 3
import numpy as np
4 4
import sys, os
5 5

  
6
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\CRAFT_pytorch_master')
7

  
6 8
app = Flask(__name__)
7 9

  
8 10
@app.route('/')
......
11 13
    
12 14
@app.route('/text_box', methods=['POST'])
13 15
def text_box():
14
    from CRAFT_pytorch_master import text_craft
16
    import text_craft
15 17

  
16 18
    r = request
17 19
    nparr = np.fromstring(r.data, np.uint8)
18 20

  
19
    img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
21
    buff = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
22
    img = buff.reshape(1, -1)
20 23

  
21
    boxes = text_craft.get_text_box(img, img_path=None, score_path=None)
24
    boxes = text_craft.get_text_box(img, img_path=None, score_path=None, trained_model=os.path.dirname(os.path.realpath(__file__)) + '\\CRAFT_pytorch_master\\weights\\craft_mlt_25k.pth')
22 25

  
23 26
    return jsonify({'text_box': boxes})
24 27
    

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)