YchKhan's picture
Update app.py
f22a924 verified
raw
history blame
777 Bytes
import gradio as gr
def list_attributes_and_values(obj):
attributes = dir(obj)
for attr in attributes:
if not attr.startswith('__'):
value = getattr(obj, attr)
print(f"{attr}: {value}")
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)
list_attributes_and_values(fi_output)
return file_path
with gr.Blocks() as demo:
tb_input = gr.Textbox(label='enter some text')
global fi_output
fi_output = gr.File(type='binary')
tb_input.submit(append_text_to_file, inputs=tb_input, outputs=fi_output)
demo.launch(debug=True)