indiapuig commited on
Commit
607b046
·
verified ·
1 Parent(s): c980517

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def save_text(text):
4
+ if text.strip():
5
+ with open("saved_text.txt", "a") as f:
6
+ f.write(text + "\n")
7
+ return "Text saved!"
8
+ else:
9
+ return "Please type something first."
10
+
11
+ # Create Gradio interface
12
+ iface = gr.Interface(
13
+ fn=save_text,
14
+ inputs=gr.Textbox(lines=5, placeholder="Type something here..."),
15
+ outputs="text",
16
+ title="Save Your Text"
17
+ )
18
+
19
+ if __name__ == "__main__":
20
+ iface.launch(server_name="0.0.0.0", server_port=7860)