Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from datasets import list_datasets, list_files
|
| 3 |
|
| 4 |
-
def list_files_and_subfolders(
|
| 5 |
-
#
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Convert list to string for display
|
| 9 |
files_and_subfolders_str = "\n".join(files_and_subfolders)
|
| 10 |
|
| 11 |
return files_and_subfolders_str
|
| 12 |
|
| 13 |
-
# List all available datasets
|
| 14 |
-
datasets = list_datasets()
|
| 15 |
-
|
| 16 |
# Gradio interface
|
| 17 |
interface = gr.Interface(
|
| 18 |
fn=list_files_and_subfolders,
|
| 19 |
-
inputs=
|
| 20 |
outputs="text",
|
| 21 |
-
title="List Files and Subfolders in
|
| 22 |
-
description="
|
| 23 |
)
|
| 24 |
|
| 25 |
interface.launch()
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
+
def list_files_and_subfolders():
|
| 5 |
+
# Get the current directory
|
| 6 |
+
current_directory = os.getcwd()
|
| 7 |
+
|
| 8 |
+
# List files and subfolders in the current directory
|
| 9 |
+
files_and_subfolders = os.listdir(current_directory)
|
| 10 |
|
| 11 |
# Convert list to string for display
|
| 12 |
files_and_subfolders_str = "\n".join(files_and_subfolders)
|
| 13 |
|
| 14 |
return files_and_subfolders_str
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
# Gradio interface
|
| 17 |
interface = gr.Interface(
|
| 18 |
fn=list_files_and_subfolders,
|
| 19 |
+
inputs=None, # No inputs required
|
| 20 |
outputs="text",
|
| 21 |
+
title="List Files and Subfolders in Current Directory",
|
| 22 |
+
description="List all files and subfolders in the current directory.",
|
| 23 |
)
|
| 24 |
|
| 25 |
interface.launch()
|