kadirnar commited on
Commit
a4e26fc
·
verified ·
1 Parent(s): b205b1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -67,17 +67,19 @@ def run_inference(model_name, prompt_text):
67
  ]
68
  subprocess.run(cmd)
69
 
70
- # Find the latest generated file in the save directory
71
- save_dir = "./output" # Or the appropriate directory where files are saved
72
- list_of_files = glob.glob(f'{save_dir}/*') # You might need to adjust the pattern
73
- latest_file = max(list_of_files, key=os.path.getctime)
 
 
 
 
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,