YchKhan commited on
Commit
bb65e5f
1 Parent(s): 5f006f6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def append_text_to_file(text):
4
+ file_path = 'text_file.txt'
5
+ with open(file_path, 'a') as file:
6
+ file.write(text + '\n')
7
+ with open(file_path, 'r') as file:
8
+ new_content = file.read()
9
+ print(new_content)
10
+
11
+ with gr.Blocks() as demo:
12
+ tb_input = gr.Textbox(label='enter some text')
13
+
14
+
15
+ tb_input.submit(append_text_to_file, inputs=tb_input, outputs=None)
16
+
17
+ demo.launch(debug=True)