import gradio as gr import os # create a new file with open('myfile.txt', 'w') as f: f.write("abc") # get the absolute path of the file abs_path = os.path.abspath('myfile.txt') gr.Interface(lambda x:abs_path, "textbox", "textbox").launch()