Spaces:
Runtime error
Runtime error
Commit
Β·
02c846c
1
Parent(s):
1a8d3b2
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,6 +91,7 @@ def reset_textbox():
|
|
| 91 |
|
| 92 |
# Episodic and Semantic IO
|
| 93 |
def list_files(file_path):
|
|
|
|
| 94 |
icon_csv = "π "
|
| 95 |
icon_txt = "π "
|
| 96 |
current_directory = os.getcwd()
|
|
@@ -98,9 +99,6 @@ def list_files(file_path):
|
|
| 98 |
for filename in os.listdir(current_directory):
|
| 99 |
if filename.endswith(".csv"):
|
| 100 |
file_list.append(icon_csv + filename)
|
| 101 |
-
# Add download button for each CSV file
|
| 102 |
-
download_button = Download(label="Download", data=os.path.join(current_directory, filename), file_name=filename)
|
| 103 |
-
file_list.append(download_button)
|
| 104 |
elif filename.endswith(".txt"):
|
| 105 |
file_list.append(icon_txt + filename)
|
| 106 |
if file_list:
|
|
@@ -194,6 +192,7 @@ with gr.Blocks(css = """#col_container {width: 1400px; margin-left: auto; margin
|
|
| 194 |
saveFile = gr.Button("πΎ Save File")
|
| 195 |
deleteFile = gr.Button("ποΈ Delete File")
|
| 196 |
appendFile = gr.Button("β Append File")
|
|
|
|
| 197 |
listFiles.click(list_files, inputs=fileName, outputs=fileContent)
|
| 198 |
readFile.click(read_file, inputs=fileName, outputs=fileContent)
|
| 199 |
saveFile.click(write_file, inputs=[fileName, fileContent], outputs=completedMessage)
|
|
|
|
| 91 |
|
| 92 |
# Episodic and Semantic IO
|
| 93 |
def list_files(file_path):
|
| 94 |
+
import os
|
| 95 |
icon_csv = "π "
|
| 96 |
icon_txt = "π "
|
| 97 |
current_directory = os.getcwd()
|
|
|
|
| 99 |
for filename in os.listdir(current_directory):
|
| 100 |
if filename.endswith(".csv"):
|
| 101 |
file_list.append(icon_csv + filename)
|
|
|
|
|
|
|
|
|
|
| 102 |
elif filename.endswith(".txt"):
|
| 103 |
file_list.append(icon_txt + filename)
|
| 104 |
if file_list:
|
|
|
|
| 192 |
saveFile = gr.Button("πΎ Save File")
|
| 193 |
deleteFile = gr.Button("ποΈ Delete File")
|
| 194 |
appendFile = gr.Button("β Append File")
|
| 195 |
+
appendFile = gr.Button("π₯ Download File")
|
| 196 |
listFiles.click(list_files, inputs=fileName, outputs=fileContent)
|
| 197 |
readFile.click(read_file, inputs=fileName, outputs=fileContent)
|
| 198 |
saveFile.click(write_file, inputs=[fileName, fileContent], outputs=completedMessage)
|