File size: 384 Bytes
607b046 cfc8f0e 607b046 afb15c7 9ec04b6 afb15c7 cfc8f0e 6631955 afb15c7 9ec04b6 afb15c7 6631955 cfc8f0e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
FILE = "saved_text.txt"
def append_text(text):
if text.strip():
with open(FILE, "a") as f:
f.write(text + "\n")
return f"Appended: {text}"
iface = gr.Interface(
fn=append_text,
inputs=gr.Textbox(lines=5, label="Type here"),
outputs="text",
title="Append Text to File"
)
if __name__ == "__main__":
iface.launch()
|