Spaces:
Build error
Build error
Download app.py from TF2SA/template_generator: direct link, hf CLI and curl.
- Browser
- Download file 586 Bytes
-
https://huggingface.co/spaces/TF2SA/template_generator/resolve/main/app.py
- Command line
-
hf download hf://spaces/TF2SA/template_generator/app.py
-
curl -L -o app.py https://huggingface.co/spaces/TF2SA/template_generator/resolve/main/app.py
586 Bytes
| 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() |