Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,6 +24,8 @@ print(f"The path to the new directory is: {new_directory_path}")
|
|
24 |
|
25 |
os.environ['GRADIO_TEMP_DIR'] = new_directory_path
|
26 |
|
|
|
|
|
27 |
def create():
|
28 |
"""
|
29 |
Create a blank image with the specified dimensions, color, and filename.
|
@@ -39,7 +41,21 @@ def create():
|
|
39 |
image = Image.new("RGB", (width, height), color)
|
40 |
# Save the image to disk
|
41 |
image.save(temp_file, format='PNG')
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
|
45 |
with gr.Blocks(delete_cache=(2,2),
|
@@ -48,6 +64,6 @@ with gr.Blocks(delete_cache=(2,2),
|
|
48 |
inp = gr.Textbox(placeholder="What is your name?")
|
49 |
out = gr.Image(type='filepath')
|
50 |
btn = gr.Button("GO!")
|
51 |
-
btn.click(create,inputs=[],outputs=out)
|
52 |
|
53 |
demo.launch(debug=False)
|
|
|
24 |
|
25 |
os.environ['GRADIO_TEMP_DIR'] = new_directory_path
|
26 |
|
27 |
+
######
|
28 |
+
|
29 |
def create():
|
30 |
"""
|
31 |
Create a blank image with the specified dimensions, color, and filename.
|
|
|
41 |
image = Image.new("RGB", (width, height), color)
|
42 |
# Save the image to disk
|
43 |
image.save(temp_file, format='PNG')
|
44 |
+
|
45 |
+
|
46 |
+
# Specify the directory you want to search in, e.g., the current directory
|
47 |
+
directory = 'temp_dir'
|
48 |
+
# List all entries in the directory
|
49 |
+
entries = os.listdir(directory)
|
50 |
+
# Filter out hidden directories
|
51 |
+
hidden_directories = [d for d in entries if os.path.isdir(os.path.join(directory, d)) and d.startswith('.')]
|
52 |
+
print("------Hidden directories:------")
|
53 |
+
for d in hidden_directories:
|
54 |
+
print(d)
|
55 |
+
hidden_directories_listing = os.listdir(d)
|
56 |
+
print(os.listdir(d))
|
57 |
+
print("-------------------------------")
|
58 |
+
return temp_file.name, hidden_directories_listing
|
59 |
|
60 |
|
61 |
with gr.Blocks(delete_cache=(2,2),
|
|
|
64 |
inp = gr.Textbox(placeholder="What is your name?")
|
65 |
out = gr.Image(type='filepath')
|
66 |
btn = gr.Button("GO!")
|
67 |
+
btn.click(create,inputs=[],outputs=[out, inp])
|
68 |
|
69 |
demo.launch(debug=False)
|