Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -67,17 +67,19 @@ def run_inference(model_name, prompt_text):
|
|
67 |
]
|
68 |
subprocess.run(cmd)
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
list_of_files
|
73 |
-
|
|
|
|
|
|
|
|
|
74 |
|
75 |
# Clean up the temporary files
|
76 |
os.remove(temp_file.name)
|
77 |
os.remove(prompt_file.name)
|
78 |
|
79 |
-
return latest_file
|
80 |
-
|
81 |
def main():
|
82 |
gr.Interface(
|
83 |
fn=run_inference,
|
|
|
67 |
]
|
68 |
subprocess.run(cmd)
|
69 |
|
70 |
+
save_dir = "./outputs/samples/" # Örneğin, inference.py tarafından kullanılan kayıt dizini
|
71 |
+
list_of_files = glob.glob(f'{save_dir}/*')
|
72 |
+
if list_of_files:
|
73 |
+
latest_file = max(list_of_files, key=os.path.getctime)
|
74 |
+
return latest_file
|
75 |
+
else:
|
76 |
+
print("No files found in the output directory.")
|
77 |
+
return None
|
78 |
|
79 |
# Clean up the temporary files
|
80 |
os.remove(temp_file.name)
|
81 |
os.remove(prompt_file.name)
|
82 |
|
|
|
|
|
83 |
def main():
|
84 |
gr.Interface(
|
85 |
fn=run_inference,
|