def __init__(self): super(RetrievalSystem, self).__init__() self.setWindowTitle('实验三-企业检索系统') self.resize(1280, 720) table1 = QTableWidget(self) table1.setColumnCount(3) table1.setHorizontalHeaderLabels(page_header) table2 = QTableWidget(self) table2.setColumnCount(3) table2.setHorizontalHeaderLabels(file_header) search = Search() self.tab1 = Retrieval(table1, search, 'page') self.tab2 = Retrieval(table2, search, 'file') self.addTab(self.tab1, "页面检索") self.addTab(self.tab2, "文档检索") self.show()
import os import io import tempfile import shutil from PIL import Image from werkzeug.utils import secure_filename from flask import Flask, render_template, url_for, request, redirect, Markup from utils import compactCode, Search search_model = compactCode(centers_path=os.path.join("centers", "centers.h5py"), pq_centers_path=os.path.join("centers", "pq_centers.h5py"), codes_path=os.path.join("centers", "codes"), codes_name=os.path.join("centers", "codes_name")) model = Search(search_model) # create temp folder os.makedirs(os.path.join("static", "temp"), exist_ok=True) # result res_img = [os.path.join("temp", "result{:02}.jpg".format(i)) for i in range(10)] # result combined com_img = [os.path.join("temp", "combined{:02}.jpg".format(i)) for i in range(10)] app = Flask(__name__) ALLOWED_EXTENSIONS = {'jpg', 'jpeg', 'png'} app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0 MAX_WIDTH = 800 MAX_HEIGHT = 550