Spaces:
Build error
Build error
Mustafa Al Hamad
commited on
Commit
·
fc67e8d
1
Parent(s):
118ec61
Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from os import listdir
|
3 |
+
def templater(name,desc,attrname):
|
4 |
+
file = ".sp"
|
5 |
+
with open(file) as f:
|
6 |
+
filecontent = ''
|
7 |
+
for line in f.readlines():
|
8 |
+
filecontent = filecontent + line
|
9 |
+
|
10 |
+
|
11 |
+
filecontent = filecontent.replace("{Name}",name)
|
12 |
+
filecontent = filecontent.replace("{Desc}",desc)
|
13 |
+
filecontent = filecontent.replace("{Attrname}",attrname)
|
14 |
+
|
15 |
+
text_file = open(name+".sp", "wt")
|
16 |
+
n = text_file.write(filecontent)
|
17 |
+
text_file.close()
|
18 |
+
return name+".sp"
|
19 |
+
demo = gr.Interface(fn=templater, inputs=['text','text','text'], outputs="file")
|
20 |
+
demo.launch()
|