awacke1 commited on
Commit
f05a5d2
โ€ข
1 Parent(s): bf36acb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -20
app.py CHANGED
@@ -19,20 +19,6 @@ def list_files(file_path):
19
  else:
20
  return "No .csv or .txt files found in the current directory."
21
 
22
-
23
- # Function to list files with .csv and .txt extensions in the current directory
24
- def list_filesold(file_path):
25
- import os
26
- current_directory = os.getcwd()
27
- file_list = []
28
- for filename in os.listdir(current_directory):
29
- if filename.endswith(".csv") or filename.endswith(".txt"):
30
- file_list.append(filename)
31
- if file_list:
32
- return "\n".join(file_list)
33
- else:
34
- return "No .csv or .txt files found in the current directory."
35
-
36
  # Function to read a file
37
  def read_file(file_path):
38
  try:
@@ -77,12 +63,12 @@ with demo:
77
  completedMessage = gr.Textbox(label="Completed")
78
 
79
  label = gr.Label()
80
-
81
- listFiles = gr.Button("๐Ÿ“„ List CSV and TXT File(s)")
82
- readFile = gr.Button("๐Ÿ“– Read File")
83
- saveFile = gr.Button("๐Ÿ’พ Save File")
84
- deleteFile = gr.Button("๐Ÿ—‘๏ธ Delete File")
85
- appendFile = gr.Button("โž• Append File")
86
 
87
  listFiles.click(list_files, inputs=fileName, outputs=fileContent)
88
  readFile.click(read_file, inputs=fileName, outputs=fileContent)
 
19
  else:
20
  return "No .csv or .txt files found in the current directory."
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  # Function to read a file
23
  def read_file(file_path):
24
  try:
 
63
  completedMessage = gr.Textbox(label="Completed")
64
 
65
  label = gr.Label()
66
+ with gr.Row():
67
+ listFiles = gr.Button("๐Ÿ“„ List CSV and TXT File(s)")
68
+ readFile = gr.Button("๐Ÿ“– Read File")
69
+ saveFile = gr.Button("๐Ÿ’พ Save File")
70
+ deleteFile = gr.Button("๐Ÿ—‘๏ธ Delete File")
71
+ appendFile = gr.Button("โž• Append File")
72
 
73
  listFiles.click(list_files, inputs=fileName, outputs=fileContent)
74
  readFile.click(read_file, inputs=fileName, outputs=fileContent)