Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,6 +26,21 @@ device="cuda" if torch.cuda.is_available() else "cpu"
|
|
| 26 |
|
| 27 |
pipe.to(device)
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
def load_model(custom_model):
|
| 30 |
|
| 31 |
if custom_model == "":
|
|
|
|
| 26 |
|
| 27 |
pipe.to(device)
|
| 28 |
|
| 29 |
+
def get_files(file_paths):
|
| 30 |
+
last_files = {} # Dictionary to store the last file for each path
|
| 31 |
+
|
| 32 |
+
for file_path in file_paths:
|
| 33 |
+
# Split the file path into directory and file components
|
| 34 |
+
directory, file_name = file_path.rsplit('/', 1)
|
| 35 |
+
|
| 36 |
+
# Update the last file for the current path
|
| 37 |
+
last_files[directory] = file_name
|
| 38 |
+
|
| 39 |
+
# Extract the last files from the dictionary
|
| 40 |
+
result = list(last_files.values())
|
| 41 |
+
|
| 42 |
+
return result
|
| 43 |
+
|
| 44 |
def load_model(custom_model):
|
| 45 |
|
| 46 |
if custom_model == "":
|