Spaces:
Sleeping
Sleeping
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Fri Feb 2 22:41:33 2024 | |
| @author: jun_chen | |
| """ | |
| from flask import Flask, jsonify, request | |
| app = Flask(__name__) | |
| 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) | |