Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,28 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
# Function to list files with .csv and .txt extensions in the current directory
|
| 5 |
def list_files(file_path):
|
| 6 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
current_directory = os.getcwd()
|
| 8 |
file_list = []
|
| 9 |
for filename in os.listdir(current_directory):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
| 3 |
# Function to list files with .csv and .txt extensions in the current directory
|
| 4 |
def list_files(file_path):
|
| 5 |
import os
|
| 6 |
+
|
| 7 |
+
icon_csv = "📄 "
|
| 8 |
+
icon_txt = "📑 "
|
| 9 |
+
|
| 10 |
+
current_directory = os.getcwd()
|
| 11 |
+
file_list = []
|
| 12 |
+
for filename in os.listdir(current_directory):
|
| 13 |
+
if filename.endswith(".csv"):
|
| 14 |
+
file_list.append(icon_csv + filename)
|
| 15 |
+
elif filename.endswith(".txt"):
|
| 16 |
+
file_list.append(icon_txt + filename)
|
| 17 |
+
if file_list:
|
| 18 |
+
return "\n".join(file_list)
|
| 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):
|