Spaces:
Build error
Build error
File size: 586 Bytes
fc67e8d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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() |