import gradio as gr from os import listdir def templater(name,desc,attrname): file = ".sp" with open(file) as f: filecontent = '' for line in f.readlines(): filecontent = filecontent + line filecontent = filecontent.replace("{Name}",name) filecontent = filecontent.replace("{Desc}",desc) filecontent = filecontent.replace("{Attrname}",attrname) text_file = open(name+".sp", "wt") n = text_file.write(filecontent) text_file.close() return name+".sp" demo = gr.Interface(fn=templater, inputs=['text','text','text'], outputs="file") demo.launch()