import gradio as gr import os root= os.path.dirname(os.path.abspath(__file__)) # create output dialogs folder if it does not exist if not os.path.exists(root + "/output_dialogs"): os.mkdir(root + "/output_dialogs") ## find all json files consisting of number (0.json, 1.json .... 123.json) #files = [f for f in os.listdir("output_dialogs") if f.endswith(".json") and f[:-5].isdigit()] # ## get name for next file (number higher than the highest number in the folder) #if len(files) == 0: # next_file = "0.json" #else: # next_file = str(max([int(f[:-5]) for f in files]) + 1) + ".json"