matsant01 commited on
Commit
2b6be77
·
1 Parent(s): 574a159

Fixing preferences management to avoid data loss

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. app.py +128 -16
  2. config.py +3 -3
  3. data/Real-Cartoon/sample_0/{alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png → alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png} +2 -2
  4. data/Real-Cartoon/{sample_1/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png → sample_0/input_bg_bb.png} +2 -2
  5. data/Real-Cartoon/{sample_10/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png → sample_1/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png} +2 -2
  6. data/Real-Cartoon/{sample_11/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png → sample_1/input_bg_bb.png} +2 -2
  7. data/Real-Cartoon/sample_10/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  8. data/Real-Cartoon/sample_10/input_bg_bb.png +3 -0
  9. data/Real-Cartoon/sample_11/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  10. data/Real-Cartoon/sample_11/input_bg_bb.png +3 -0
  11. data/Real-Cartoon/sample_12/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  12. data/Real-Cartoon/sample_12/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  13. data/Real-Cartoon/sample_12/input_bg_bb.png +3 -0
  14. data/Real-Cartoon/sample_13/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  15. data/Real-Cartoon/sample_13/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  16. data/Real-Cartoon/sample_13/input_bg_bb.png +3 -0
  17. data/Real-Cartoon/sample_14/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  18. data/Real-Cartoon/sample_14/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  19. data/Real-Cartoon/sample_14/input_bg_bb.png +3 -0
  20. data/Real-Cartoon/sample_15/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  21. data/Real-Cartoon/sample_15/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  22. data/Real-Cartoon/sample_15/input_bg_bb.png +3 -0
  23. data/Real-Cartoon/sample_16/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  24. data/Real-Cartoon/sample_16/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  25. data/Real-Cartoon/sample_16/input_bg_bb.png +3 -0
  26. data/Real-Cartoon/sample_17/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  27. data/Real-Cartoon/sample_17/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  28. data/Real-Cartoon/sample_17/input_bg_bb.png +3 -0
  29. data/Real-Cartoon/sample_18/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  30. data/Real-Cartoon/sample_18/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  31. data/Real-Cartoon/sample_18/input_bg_bb.png +3 -0
  32. data/Real-Cartoon/sample_19/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  33. data/Real-Cartoon/sample_19/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  34. data/Real-Cartoon/sample_19/input_bg_bb.png +3 -0
  35. data/Real-Cartoon/sample_2/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  36. data/Real-Cartoon/sample_2/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  37. data/Real-Cartoon/sample_2/input_bg_bb.png +3 -0
  38. data/Real-Cartoon/sample_20/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  39. data/Real-Cartoon/sample_20/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  40. data/Real-Cartoon/sample_20/input_bg_bb.png +3 -0
  41. data/Real-Cartoon/sample_21/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  42. data/Real-Cartoon/sample_21/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  43. data/Real-Cartoon/sample_21/input_bg_bb.png +3 -0
  44. data/Real-Cartoon/sample_22/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  45. data/Real-Cartoon/sample_22/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  46. data/Real-Cartoon/sample_22/input_bg_bb.png +3 -0
  47. data/Real-Cartoon/sample_23/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
  48. data/Real-Cartoon/sample_23/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png +0 -3
  49. data/Real-Cartoon/sample_23/input_bg_bb.png +3 -0
  50. data/Real-Cartoon/sample_24/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png +3 -0
app.py CHANGED
@@ -5,6 +5,7 @@ import random
5
  from datetime import datetime
6
  from apscheduler.schedulers.background import BackgroundScheduler
7
  from PIL import Image
 
8
 
9
  import config
10
  import utils
@@ -13,22 +14,87 @@ import utils
13
  # Attempt to log in to Hugging Face Hub at startup
14
  utils.login_hugging_face()
15
 
16
- # Load preferences: Try from Hub, then local, then empty
 
 
 
 
 
17
  preferences_df = utils.load_preferences_from_hf_hub(config.HF_DATASET_REPO_ID, config.RESULTS_CSV_FILE)
 
18
  if preferences_df is None:
 
19
  if os.path.exists(config.RESULTS_CSV_FILE):
20
- print(f"Loading preferences from local file: {config.RESULTS_CSV_FILE}")
21
  try:
22
  preferences_df = pd.read_csv(config.RESULTS_CSV_FILE)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  except pd.errors.EmptyDataError:
24
- print(f"Local preferences file {config.RESULTS_CSV_FILE} is empty. Starting fresh.")
25
  preferences_df = pd.DataFrame(columns=config.CSV_HEADERS)
 
26
  except Exception as e:
27
- print(f"Error loading local {config.RESULTS_CSV_FILE}: {e}. Starting fresh.")
28
  preferences_df = pd.DataFrame(columns=config.CSV_HEADERS)
 
29
  else:
30
- print("No existing preferences found on Hub or locally. Starting with an empty table.")
31
  preferences_df = pd.DataFrame(columns=config.CSV_HEADERS)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  # Scan for available data
34
  ALL_SAMPLES_BY_DOMAIN = utils.scan_data_directory(config.DATA_FOLDER)
@@ -39,11 +105,32 @@ if not ALL_SAMPLES_BY_DOMAIN:
39
  # --- Scheduler for Periodic Uploads ---
40
  def scheduled_upload_job():
41
  global preferences_df
42
- print(f"Running scheduled job: Saving and uploading preferences at {datetime.now()}")
43
- if preferences_df is not None and not preferences_df.empty:
44
- utils.save_preferences_to_hf_hub(preferences_df, config.HF_DATASET_REPO_ID, config.RESULTS_CSV_FILE, commit_message="Periodic background update")
45
- else:
46
- print("Scheduled job: Preferences DataFrame is empty. Nothing to upload.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  scheduler = BackgroundScheduler()
49
  scheduler.add_job(scheduled_upload_job, 'interval', hours=config.PUSH_INTERVAL_HOURS)
@@ -175,15 +262,40 @@ def process_vote(choice_index, session_id, sample_queue, current_sample_index, c
175
  preferred_model_key=preferred_model_key
176
  )
177
 
178
- try:
179
- preferences_df.to_csv(config.RESULTS_CSV_FILE, index=False)
180
- print(f"Preferences saved locally to {config.RESULTS_CSV_FILE}")
181
- except Exception as e:
182
- print(f"Error saving preferences locally: {e}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
  current_sample_index += 1
185
  if current_sample_index >= len(sample_queue):
186
- utils.save_preferences_to_hf_hub(preferences_df, config.HF_DATASET_REPO_ID, config.RESULTS_CSV_FILE, commit_message="Session end update")
 
187
  final_msg = f"# 🎉 Session Complete! 🎉\n\n### All samples have been rated. Thank you for your participation!"
188
  return preferences_df, current_sample_index, final_msg, None, None, None, [], [], True
189
 
 
5
  from datetime import datetime
6
  from apscheduler.schedulers.background import BackgroundScheduler
7
  from PIL import Image
8
+ from filelock import FileLock # Added for file locking
9
 
10
  import config
11
  import utils
 
14
  # Attempt to log in to Hugging Face Hub at startup
15
  utils.login_hugging_face()
16
 
17
+ print(f"Attempting to load preferences from Hugging Face Hub, ensuring local {config.RESULTS_CSV_FILE} is synchronized.")
18
+ # We assume utils.load_preferences_from_hf_hub:
19
+ # 1. Downloads from Hub, overwrites local config.RESULTS_CSV_FILE.
20
+ # 2. If Hub file doesn't exist, local config.RESULTS_CSV_FILE becomes empty (or reflects this).
21
+ # 3. Returns the DataFrame loaded from the (now synchronized) local file.
22
+ # 4. Returns None on major failure (e.g. network, file not found on Hub).
23
  preferences_df = utils.load_preferences_from_hf_hub(config.HF_DATASET_REPO_ID, config.RESULTS_CSV_FILE)
24
+
25
  if preferences_df is None:
26
+ print(f"Failed to load from Hub or Hub is empty/file not found. Initializing/loading from {config.RESULTS_CSV_FILE} as a fallback.")
27
  if os.path.exists(config.RESULTS_CSV_FILE):
 
28
  try:
29
  preferences_df = pd.read_csv(config.RESULTS_CSV_FILE)
30
+ if not preferences_df.empty and list(preferences_df.columns) != config.CSV_HEADERS:
31
+ print(f"Warning: Local CSV {config.RESULTS_CSV_FILE} columns ({list(preferences_df.columns)}) do not match expected headers ({config.CSV_HEADERS}). Re-initializing file and DataFrame.")
32
+ preferences_df = pd.DataFrame(columns=config.CSV_HEADERS)
33
+ preferences_df.to_csv(config.RESULTS_CSV_FILE, index=False)
34
+ elif preferences_df.empty: # Loaded an empty DataFrame
35
+ # Check if the file itself had incorrect headers or was truly empty
36
+ current_headers = []
37
+ if os.path.getsize(config.RESULTS_CSV_FILE) > 0:
38
+ try:
39
+ current_headers = list(pd.read_csv(config.RESULTS_CSV_FILE, nrows=0).columns)
40
+ except Exception: # Handle cases where reading headers might fail
41
+ pass # Will be caught by re-initialization if headers are bad
42
+ if current_headers != config.CSV_HEADERS:
43
+ print(f"Local CSV {config.RESULTS_CSV_FILE} is empty or has incorrect headers. Re-initializing file and DataFrame with correct headers.")
44
+ preferences_df = pd.DataFrame(columns=config.CSV_HEADERS)
45
+ preferences_df.to_csv(config.RESULTS_CSV_FILE, index=False)
46
+ else: # Empty dataframe, but headers in file are correct
47
+ preferences_df = pd.DataFrame(columns=config.CSV_HEADERS) # Ensure in-memory df also has columns
48
+
49
  except pd.errors.EmptyDataError:
50
+ print(f"Local CSV {config.RESULTS_CSV_FILE} is empty. Initializing file and DataFrame with headers.")
51
  preferences_df = pd.DataFrame(columns=config.CSV_HEADERS)
52
+ preferences_df.to_csv(config.RESULTS_CSV_FILE, index=False)
53
  except Exception as e:
54
+ print(f"Error loading local {config.RESULTS_CSV_FILE}: {e}. Initializing file and DataFrame.")
55
  preferences_df = pd.DataFrame(columns=config.CSV_HEADERS)
56
+ preferences_df.to_csv(config.RESULTS_CSV_FILE, index=False)
57
  else:
58
+ print(f"Local CSV {config.RESULTS_CSV_FILE} not found. Initializing file and DataFrame.")
59
  preferences_df = pd.DataFrame(columns=config.CSV_HEADERS)
60
+ preferences_df.to_csv(config.RESULTS_CSV_FILE, index=False)
61
+ else:
62
+ # Successfully loaded from Hub; local file config.RESULTS_CSV_FILE should be synchronized.
63
+ print(f"Successfully loaded preferences from Hugging Face Hub. Local copy at {config.RESULTS_CSV_FILE} should be up-to-date.")
64
+ if not preferences_df.empty and list(preferences_df.columns) != config.CSV_HEADERS:
65
+ print(f"CRITICAL: Data from Hub has incorrect columns {list(preferences_df.columns)}. Expected {config.CSV_HEADERS}. Re-initializing local file and DataFrame to empty to prevent corruption.")
66
+ preferences_df = pd.DataFrame(columns=config.CSV_HEADERS)
67
+ preferences_df.to_csv(config.RESULTS_CSV_FILE, index=False)
68
+ elif preferences_df.empty:
69
+ # Hub data is empty. Ensure DataFrame in memory has correct columns.
70
+ # And ensure the local CSV (which should have been written by load_preferences_from_hf_hub) has correct headers.
71
+ if list(preferences_df.columns) != config.CSV_HEADERS:
72
+ preferences_df = pd.DataFrame(columns=config.CSV_HEADERS) # Correct columns in memory
73
+
74
+ # Ensure the local file has correct headers if it's empty or its headers are wrong
75
+ needs_header_rewrite = True
76
+ if os.path.exists(config.RESULTS_CSV_FILE):
77
+ if os.path.getsize(config.RESULTS_CSV_FILE) == 0: # File is completely empty
78
+ needs_header_rewrite = True
79
+ else:
80
+ try:
81
+ local_headers = list(pd.read_csv(config.RESULTS_CSV_FILE, nrows=0).columns)
82
+ if local_headers == config.CSV_HEADERS:
83
+ needs_header_rewrite = False
84
+ except Exception: # Error reading headers, assume rewrite is needed
85
+ pass
86
+ if needs_header_rewrite:
87
+ print(f"Local file {config.RESULTS_CSV_FILE} (after Hub sync resulted in empty data) is empty or has incorrect headers. Writing/Re-writing headers.")
88
+ pd.DataFrame(columns=config.CSV_HEADERS).to_csv(config.RESULTS_CSV_FILE, index=False)
89
+
90
+
91
+ # Final safety net: ensure preferences_df is a DataFrame with correct columns.
92
+ if not isinstance(preferences_df, pd.DataFrame) or list(preferences_df.columns) != config.CSV_HEADERS:
93
+ print("Critical: preferences_df is not a valid DataFrame with correct headers after initialization. Resetting to empty with correct headers.")
94
+ preferences_df = pd.DataFrame(columns=config.CSV_HEADERS)
95
+ # Ensure the CSV file reflects this state
96
+ preferences_df.to_csv(config.RESULTS_CSV_FILE, index=False)
97
+
98
 
99
  # Scan for available data
100
  ALL_SAMPLES_BY_DOMAIN = utils.scan_data_directory(config.DATA_FOLDER)
 
105
  # --- Scheduler for Periodic Uploads ---
106
  def scheduled_upload_job():
107
  global preferences_df
108
+ print(f"Running scheduled job: Preparing to upload preferences from {config.RESULTS_CSV_FILE} at {datetime.now()}")
109
+
110
+ lock_path = config.RESULTS_CSV_FILE + ".lock"
111
+ with FileLock(lock_path):
112
+ print(f"Acquired lock for scheduled upload: {lock_path}")
113
+ if os.path.exists(config.RESULTS_CSV_FILE):
114
+ try:
115
+ # Read the current state of the CSV file for upload
116
+ df_to_upload = pd.read_csv(config.RESULTS_CSV_FILE)
117
+ if not df_to_upload.empty:
118
+ utils.save_preferences_to_hf_hub(
119
+ df_to_upload, # df_to_upload is passed for the empty check inside save_preferences_to_hf_hub
120
+ config.HF_DATASET_REPO_ID,
121
+ config.RESULTS_CSV_FILE, # This is the target filename on the Hub
122
+ commit_message="Periodic background update"
123
+ )
124
+ print(f"Scheduled job: Attempted upload of data from {config.RESULTS_CSV_FILE}.")
125
+ else:
126
+ print(f"Scheduled job: Local preferences file {config.RESULTS_CSV_FILE} is empty. Nothing to upload.")
127
+ except pd.errors.EmptyDataError:
128
+ print(f"Scheduled job: Local preferences file {config.RESULTS_CSV_FILE} is empty (read as EmptyDataError). Nothing to upload.")
129
+ except Exception as e:
130
+ print(f"Scheduled job: Error reading or uploading {config.RESULTS_CSV_FILE}: {e}")
131
+ else:
132
+ print(f"Scheduled job: Local preferences file {config.RESULTS_CSV_FILE} does not exist. Nothing to upload.")
133
+ print(f"Released lock for scheduled upload: {lock_path}")
134
 
135
  scheduler = BackgroundScheduler()
136
  scheduler.add_job(scheduled_upload_job, 'interval', hours=config.PUSH_INTERVAL_HOURS)
 
262
  preferred_model_key=preferred_model_key
263
  )
264
 
265
+ # Append the new preference to the CSV file
266
+ if not preferences_df.empty:
267
+ new_preference_df = preferences_df.iloc[-1:] # Get the last row as a new DataFrame
268
+
269
+ lock_path = config.RESULTS_CSV_FILE + ".lock"
270
+ with FileLock(lock_path):
271
+ print(f"Acquired lock for vote processing: {lock_path}")
272
+ try:
273
+ file_exists_and_has_content = os.path.exists(config.RESULTS_CSV_FILE) and os.path.getsize(config.RESULTS_CSV_FILE) > 0
274
+ new_preference_df.to_csv(
275
+ config.RESULTS_CSV_FILE,
276
+ mode='a',
277
+ header=not file_exists_and_has_content, # Write header if file is new or empty
278
+ index=False
279
+ )
280
+ print(f"Appended new preference to {config.RESULTS_CSV_FILE}")
281
+ except Exception as e:
282
+ print(f"Error appending preference to local CSV {config.RESULTS_CSV_FILE}: {e}")
283
+ finally:
284
+ print(f"Released lock for vote processing: {lock_path}")
285
+ else:
286
+ print("Warning: preferences_df is empty after utils.record_preference. Cannot append to CSV.")
287
+
288
+ # Removed full CSV overwrite:
289
+ # try:
290
+ # preferences_df.to_csv(config.RESULTS_CSV_FILE, index=False)
291
+ # print(f"Preferences saved locally to {config.RESULTS_CSV_FILE}")
292
+ # except Exception as e:
293
+ # print(f"Error saving preferences locally: {e}")
294
 
295
  current_sample_index += 1
296
  if current_sample_index >= len(sample_queue):
297
+ # Removed session end upload:
298
+ # utils.save_preferences_to_hf_hub(preferences_df, config.HF_DATASET_REPO_ID, config.RESULTS_CSV_FILE, commit_message="Session end update")
299
  final_msg = f"# 🎉 Session Complete! 🎉\n\n### All samples have been rated. Thank you for your participation!"
300
  return preferences_df, current_sample_index, final_msg, None, None, None, [], [], True
301
 
config.py CHANGED
@@ -2,7 +2,7 @@
2
 
3
  # --- File and Folder Names ---
4
  DATA_FOLDER = "data" # Main folder containing domain subfolders
5
- BACKGROUND_IMAGE_NAME = "input_bg.jpg" # Standard name for background input
6
  FOREGROUND_IMAGE_NAME = "input_fg.jpg" # Standard name for foreground input
7
  PROMPT_FILE_NAME = "prompt.txt" # Standard name for the prompt file
8
  # Names for the output images from different models.
@@ -11,7 +11,7 @@ MODEL_OUTPUT_IMAGE_NAMES = {
11
  "baseline": "cp_bg_fg.jpg",
12
  "kv-edit": "kvedit.jpg",
13
  "tf-icon": "tf-icon.png",
14
- "dit-editor": "alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png",
15
  }
16
  # Names to display for each model in the UI (can be different from filenames)
17
  MODEL_DISPLAY_NAMES = {
@@ -43,7 +43,7 @@ SAMPLES_PER_DOMAIN = 3 # Number of samples to show from each domain per user ses
43
  # --- Hugging Face Hub ---
44
  HF_DATASET_REPO_ID = "matsant01/dit-editor-collected-preferences" # Replace with your actual repo ID
45
  HF_TOKEN = None # Set this if your dataset is private, or use HF_HUB_TOKEN env var
46
- PUSH_INTERVAL_HOURS = 1 # Interval in hours to push results to the Hub
47
 
48
  # --- UI Configuration ---
49
  IMAGE_DISPLAY_SIZE = (300, 300) # (width, height) for displaying images
 
2
 
3
  # --- File and Folder Names ---
4
  DATA_FOLDER = "data" # Main folder containing domain subfolders
5
+ BACKGROUND_IMAGE_NAME = "input_bg_bb.png" # Standard name for background input
6
  FOREGROUND_IMAGE_NAME = "input_fg.jpg" # Standard name for foreground input
7
  PROMPT_FILE_NAME = "prompt.txt" # Standard name for the prompt file
8
  # Names for the output images from different models.
 
11
  "baseline": "cp_bg_fg.jpg",
12
  "kv-edit": "kvedit.jpg",
13
  "tf-icon": "tf-icon.png",
14
+ "dit-editor": "alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png",
15
  }
16
  # Names to display for each model in the UI (can be different from filenames)
17
  MODEL_DISPLAY_NAMES = {
 
43
  # --- Hugging Face Hub ---
44
  HF_DATASET_REPO_ID = "matsant01/dit-editor-collected-preferences" # Replace with your actual repo ID
45
  HF_TOKEN = None # Set this if your dataset is private, or use HF_HUB_TOKEN env var
46
+ PUSH_INTERVAL_HOURS = 0.05 # Interval in hours to push results to the Hub
47
 
48
  # --- UI Configuration ---
49
  IMAGE_DISPLAY_SIZE = (300, 300) # (width, height) for displaying images
data/Real-Cartoon/sample_0/{alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png → alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png} RENAMED
File without changes
data/Real-Cartoon/{sample_1/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png → sample_0/input_bg_bb.png} RENAMED
File without changes
data/Real-Cartoon/{sample_10/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png → sample_1/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png} RENAMED
File without changes
data/Real-Cartoon/{sample_11/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png → sample_1/input_bg_bb.png} RENAMED
File without changes
data/Real-Cartoon/sample_10/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: c3b167e7b12f22bb8e4bc7fb052b14d2238a4cf2bfabf4138696dda280fdd729
  • Pointer size: 131 Bytes
  • Size of remote file: 331 kB
data/Real-Cartoon/sample_10/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: e68c96ea31bbb3deed9f5111d1d80d6227dfcb34dd5c69fe620006ceac0f8ada
  • Pointer size: 131 Bytes
  • Size of remote file: 370 kB
data/Real-Cartoon/sample_11/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: a24bb9aff304f7f166da4b0ae7aa953c0cc0bf529fb528a889f7eeb1c69199c0
  • Pointer size: 131 Bytes
  • Size of remote file: 342 kB
data/Real-Cartoon/sample_11/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: a46ab9abaed106cb486e80e938378002b1acd14edb6174d5f71d72727a584215
  • Pointer size: 131 Bytes
  • Size of remote file: 371 kB
data/Real-Cartoon/sample_12/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: eadb4cf9a3e9ee2c89996564f20584609deb811033697079c0ef93cf90a93f01
  • Pointer size: 131 Bytes
  • Size of remote file: 332 kB
data/Real-Cartoon/sample_12/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: cb5e77e7a70120af39ffa36810e4aadb50f78d58efc129862977d1d89ea5b2bb
  • Pointer size: 131 Bytes
  • Size of remote file: 334 kB
data/Real-Cartoon/sample_12/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: 83af2ee3a90136747600df8cb25c14431fdbf04eb72937540e49bb12555219b0
  • Pointer size: 131 Bytes
  • Size of remote file: 374 kB
data/Real-Cartoon/sample_13/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: d6ba611710fa1528e80b20d3cf05a1b5ee4d4af8a838b6e030fdfac6527a865e
  • Pointer size: 131 Bytes
  • Size of remote file: 337 kB
data/Real-Cartoon/sample_13/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: 5d27e8dcce9baf4afc8f3359196dbb7a1c1f446af77ff223351a7108bb7f7d53
  • Pointer size: 131 Bytes
  • Size of remote file: 337 kB
data/Real-Cartoon/sample_13/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: a46ab9abaed106cb486e80e938378002b1acd14edb6174d5f71d72727a584215
  • Pointer size: 131 Bytes
  • Size of remote file: 371 kB
data/Real-Cartoon/sample_14/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: 269413ba83e246099727fc74d0f5cbd70c74c94a68c99ad32cb25e26037c808f
  • Pointer size: 131 Bytes
  • Size of remote file: 339 kB
data/Real-Cartoon/sample_14/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: 02d94a6916c1f9fa2dd408683d8f90d9ad3a3e5027e10c624637ca19ad7fcd38
  • Pointer size: 131 Bytes
  • Size of remote file: 340 kB
data/Real-Cartoon/sample_14/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: a46ab9abaed106cb486e80e938378002b1acd14edb6174d5f71d72727a584215
  • Pointer size: 131 Bytes
  • Size of remote file: 371 kB
data/Real-Cartoon/sample_15/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: deed0434f7c674328841207959aa9fa0dfdad27960fc609d43075cd59c1688ad
  • Pointer size: 131 Bytes
  • Size of remote file: 350 kB
data/Real-Cartoon/sample_15/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: bdafba39357ef709c1ef8212f080d2e25a3105f363043bda8bed2843a3da696d
  • Pointer size: 131 Bytes
  • Size of remote file: 350 kB
data/Real-Cartoon/sample_15/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: a46ab9abaed106cb486e80e938378002b1acd14edb6174d5f71d72727a584215
  • Pointer size: 131 Bytes
  • Size of remote file: 371 kB
data/Real-Cartoon/sample_16/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: 94e6edb9d56c3f0f2c5472706392f3710e731f66488d1b07ec2518a83bb4cfe7
  • Pointer size: 131 Bytes
  • Size of remote file: 337 kB
data/Real-Cartoon/sample_16/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: f65f884145effd5e1d876b3b0bbd277c7dbd54b98c0d932bce675c8584816ad7
  • Pointer size: 131 Bytes
  • Size of remote file: 334 kB
data/Real-Cartoon/sample_16/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: a46ab9abaed106cb486e80e938378002b1acd14edb6174d5f71d72727a584215
  • Pointer size: 131 Bytes
  • Size of remote file: 371 kB
data/Real-Cartoon/sample_17/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: 252e02f5912a286bcce098abf0abe53aba879aa448576838ff99e69795ac88fa
  • Pointer size: 131 Bytes
  • Size of remote file: 264 kB
data/Real-Cartoon/sample_17/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: e6c0308e6bc7430a7981f38d2530b79065f0f13187325481c0c2fef6f295e0a5
  • Pointer size: 131 Bytes
  • Size of remote file: 266 kB
data/Real-Cartoon/sample_17/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: b0c7f80d7ea8f865faf9e32500f2fdc2ca66b16bc75b7bbbd62e9c09fc8bcb8d
  • Pointer size: 131 Bytes
  • Size of remote file: 285 kB
data/Real-Cartoon/sample_18/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: a998a53800c2e329c4688de6fdd9be5e2276060d3c657e79cd9e78c0f4fa9c5b
  • Pointer size: 131 Bytes
  • Size of remote file: 315 kB
data/Real-Cartoon/sample_18/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: 86f074ec8e3be951204cd265a1e5f903dae953d369c704c8077c8d25493ce4e8
  • Pointer size: 131 Bytes
  • Size of remote file: 316 kB
data/Real-Cartoon/sample_18/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: 9114ce9595eebf4a07b7c957802c53446dfa875bfb0d7c72689d6da584b4f12a
  • Pointer size: 131 Bytes
  • Size of remote file: 363 kB
data/Real-Cartoon/sample_19/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: 6493545abd36a373a57c6cab4ebeeae811834b36b1d0911b494882eec013f8cf
  • Pointer size: 131 Bytes
  • Size of remote file: 264 kB
data/Real-Cartoon/sample_19/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: 09f97ddd0940b18cf8d0d6e3269cbe59c74a2d7f719147d58d767bfbfda95e12
  • Pointer size: 131 Bytes
  • Size of remote file: 265 kB
data/Real-Cartoon/sample_19/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: b0c7f80d7ea8f865faf9e32500f2fdc2ca66b16bc75b7bbbd62e9c09fc8bcb8d
  • Pointer size: 131 Bytes
  • Size of remote file: 285 kB
data/Real-Cartoon/sample_2/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: 1b7de40c108e51daa7a8386fcb7a08490e500dd06165582e0c3bdfecd9c60b75
  • Pointer size: 131 Bytes
  • Size of remote file: 215 kB
data/Real-Cartoon/sample_2/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: bf3608c35fb6ba21aba927543cd2fe2c67eeecaf943f5b8895b82f69a91dadf0
  • Pointer size: 131 Bytes
  • Size of remote file: 215 kB
data/Real-Cartoon/sample_2/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: 5b4da01089b20ca05f8c759f0fbcfa8d469b771bb7e326548a942bdf48f77c6c
  • Pointer size: 131 Bytes
  • Size of remote file: 230 kB
data/Real-Cartoon/sample_20/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: 68d94b9078f6620383be1fc41224852227f7311bc108e2ce46ce3649d4367a8e
  • Pointer size: 131 Bytes
  • Size of remote file: 333 kB
data/Real-Cartoon/sample_20/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: a14954637ce9316e09a635db4d708dc032050e8566a747df6d15c933eb46bd90
  • Pointer size: 131 Bytes
  • Size of remote file: 335 kB
data/Real-Cartoon/sample_20/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: f94deb7e6f11517194200e105a89d0a137df7bd2c776e8081935a5d816c9e494
  • Pointer size: 131 Bytes
  • Size of remote file: 373 kB
data/Real-Cartoon/sample_21/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: 9d8a37961631d4e7ca659cf3200e2284f6aa8341645ad6d0afd9f14e6b7358fc
  • Pointer size: 131 Bytes
  • Size of remote file: 346 kB
data/Real-Cartoon/sample_21/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: 5ef4e46e29257f29147f100b382c5f8093e9add119bd39bc2d8c6e54038f9638
  • Pointer size: 131 Bytes
  • Size of remote file: 346 kB
data/Real-Cartoon/sample_21/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: a46ab9abaed106cb486e80e938378002b1acd14edb6174d5f71d72727a584215
  • Pointer size: 131 Bytes
  • Size of remote file: 371 kB
data/Real-Cartoon/sample_22/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: af52efb58eb1dbd57589f53b4f34cc30f59654b67fd86f7d2aff5c873495983e
  • Pointer size: 131 Bytes
  • Size of remote file: 334 kB
data/Real-Cartoon/sample_22/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: 01fbc239d83b72ff4f85766a8bb06f2f76f92817f38922c5541ea8190210d8a1
  • Pointer size: 131 Bytes
  • Size of remote file: 334 kB
data/Real-Cartoon/sample_22/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: a46ab9abaed106cb486e80e938378002b1acd14edb6174d5f71d72727a584215
  • Pointer size: 131 Bytes
  • Size of remote file: 371 kB
data/Real-Cartoon/sample_23/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: 919339d9a9c75d3afacccd0b45cb162efaa00fd37a8eeaed6653e6969a3b3311
  • Pointer size: 131 Bytes
  • Size of remote file: 335 kB
data/Real-Cartoon/sample_23/alphanoise0.05_timesteps50_QTrue_KTrue_VTrue_taua0.4_taub0.8_guidance3.0.png DELETED

Git LFS Details

  • SHA256: e94a58f5962f40d1891b7b4a3d755bf9f22f8b03d10397fce9d5259ee953eda8
  • Pointer size: 131 Bytes
  • Size of remote file: 339 kB
data/Real-Cartoon/sample_23/input_bg_bb.png ADDED

Git LFS Details

  • SHA256: a6fff1d794d2d342d5afcaf024e8280ff5e676543dee1ec26cce2b51a56add58
  • Pointer size: 131 Bytes
  • Size of remote file: 373 kB
data/Real-Cartoon/sample_24/alphanoise0.05_timesteps50_QTrue_KTrue_VFalse_taua0.4_taub0.8_guidance3.0_all-layers.png ADDED

Git LFS Details

  • SHA256: 9492534ca94083b837a7dcbf86a723abc07b264b2f8acfdb49559a7e187398db
  • Pointer size: 131 Bytes
  • Size of remote file: 345 kB