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()