Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ import gradio as gr
|
|
3 |
def list_attributes_and_values(obj):
|
4 |
attributes = dir(obj)
|
5 |
for attr in attributes:
|
6 |
-
# Filter out special (magic) methods and attributes
|
7 |
if not attr.startswith('__'):
|
8 |
value = getattr(obj, attr)
|
9 |
print(f"{attr}: {value}")
|
@@ -15,14 +14,14 @@ def append_text_to_file(text):
|
|
15 |
with open(file_path, 'r') as file:
|
16 |
new_content = file.read()
|
17 |
print(new_content)
|
|
|
18 |
return file_path
|
19 |
|
20 |
with gr.Blocks() as demo:
|
21 |
tb_input = gr.Textbox(label='enter some text')
|
|
|
22 |
fi_output = gr.File(type='binary')
|
23 |
-
|
24 |
-
list_attributes_and_values(fi_output)
|
25 |
-
|
26 |
tb_input.submit(append_text_to_file, inputs=tb_input, outputs=fi_output)
|
27 |
|
28 |
demo.launch(debug=True)
|
|
|
3 |
def list_attributes_and_values(obj):
|
4 |
attributes = dir(obj)
|
5 |
for attr in attributes:
|
|
|
6 |
if not attr.startswith('__'):
|
7 |
value = getattr(obj, attr)
|
8 |
print(f"{attr}: {value}")
|
|
|
14 |
with open(file_path, 'r') as file:
|
15 |
new_content = file.read()
|
16 |
print(new_content)
|
17 |
+
list_attributes_and_values(fi_output)
|
18 |
return file_path
|
19 |
|
20 |
with gr.Blocks() as demo:
|
21 |
tb_input = gr.Textbox(label='enter some text')
|
22 |
+
global fi_output
|
23 |
fi_output = gr.File(type='binary')
|
24 |
+
|
|
|
|
|
25 |
tb_input.submit(append_text_to_file, inputs=tb_input, outputs=fi_output)
|
26 |
|
27 |
demo.launch(debug=True)
|