file-concat / index.py
junchen-emerson's picture
added new file.
26a4bc0
raw
history blame contribute delete
590 Bytes
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 2 22:41:33 2024
@author: jun_chen
"""
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.route('/file-concat/file_select', methods=['GET', 'POST'])
def file_select():
from tkinter import Tk
from tkinter.filedialog import askopenfilename
root = Tk()
root.withdraw()
# ensure the file dialog pops to the top window
root.wm_attributes('-topmost', 1)
fname = askopenfilename(parent=root)
return jsonify({'filepath': fname})
#start the flask app.
app.run(host ='localhost', port = 5000)