File size: 435 Bytes
bb65e5f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
def append_text_to_file(text):
file_path = 'text_file.txt'
with open(file_path, 'a') as file:
file.write(text + '\n')
with open(file_path, 'r') as file:
new_content = file.read()
print(new_content)
with gr.Blocks() as demo:
tb_input = gr.Textbox(label='enter some text')
tb_input.submit(append_text_to_file, inputs=tb_input, outputs=None)
demo.launch(debug=True) |