Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
def list_attributes_and_values(obj):
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
print(f"{attr}: {value}")
|
| 9 |
|
| 10 |
def append_text_to_file(text):
|
| 11 |
file_path = 'text_file.txt'
|
|
@@ -14,7 +13,7 @@ def append_text_to_file(text):
|
|
| 14 |
with open(file_path, 'r') as file:
|
| 15 |
new_content = file.read()
|
| 16 |
print(new_content)
|
| 17 |
-
|
| 18 |
return file_path
|
| 19 |
|
| 20 |
with gr.Blocks() as demo:
|
|
@@ -23,5 +22,7 @@ with gr.Blocks() as demo:
|
|
| 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)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
def list_attributes_and_values(obj):
|
| 4 |
+
attr = 'temp_files'
|
| 5 |
+
value = getattr(obj, attr)
|
| 6 |
+
for tmp in value:
|
| 7 |
+
print(f"https://organizedprogrammers-test-file-editing.hf.space/file={tmp}")
|
|
|
|
| 8 |
|
| 9 |
def append_text_to_file(text):
|
| 10 |
file_path = 'text_file.txt'
|
|
|
|
| 13 |
with open(file_path, 'r') as file:
|
| 14 |
new_content = file.read()
|
| 15 |
print(new_content)
|
| 16 |
+
|
| 17 |
return file_path
|
| 18 |
|
| 19 |
with gr.Blocks() as demo:
|
|
|
|
| 22 |
fi_output = gr.File(type='binary')
|
| 23 |
|
| 24 |
tb_input.submit(append_text_to_file, inputs=tb_input, outputs=fi_output)
|
| 25 |
+
|
| 26 |
+
fi_output.change(list_attributes_and_values, inputs=fi_output, outputs=None)
|
| 27 |
|
| 28 |
demo.launch(debug=True)
|