File size: 448 Bytes
b201fe6
 
 
 
 
6af5c0f
 
 
 
 
 
 
 
 
 
 
 
 
b201fe6
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr

def greet(name):
    return "Hello " + name + "!!"

# Inside your Space's code
PERSISTENT_DIR = "/data"
output_file = f"{PERSISTENT_DIR}/my_generated_data.txt"

# Make sure the directory exists
import os
os.makedirs(PERSISTENT_DIR, exist_ok=True)

# Save your data
with open(output_file, 'w') as f:
    f.write('test test')
print('test file written')

demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()