Spaces:
Running
Running
XinyueWangg
commited on
Commit
•
6af5c0f
1
Parent(s):
9a61130
Update app.py
Browse files
app.py
CHANGED
@@ -3,5 +3,18 @@ import gradio as gr
|
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
demo.launch()
|
|
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
+
# Inside your Space's code
|
7 |
+
PERSISTENT_DIR = "/data"
|
8 |
+
output_file = f"{PERSISTENT_DIR}/my_generated_data.txt"
|
9 |
+
|
10 |
+
# Make sure the directory exists
|
11 |
+
import os
|
12 |
+
os.makedirs(PERSISTENT_DIR, exist_ok=True)
|
13 |
+
|
14 |
+
# Save your data
|
15 |
+
with open(output_file, 'w') as f:
|
16 |
+
f.write('test test')
|
17 |
+
print('test file written')
|
18 |
+
|
19 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
20 |
demo.launch()
|