XA7 commited on
Commit
d3030d0
·
1 Parent(s): e037628
models/comic_image_generator.py CHANGED
@@ -25,20 +25,20 @@ def log_execution(func):
25
  def wrapper(*args, **kwargs):
26
  start_time = time.time()
27
  start_str = datetime.fromtimestamp(start_time).strftime('%Y-%m-%d %H:%M:%S')
28
-
29
  result = func(*args, **kwargs)
30
-
31
  end_time = time.time()
32
  end_str = datetime.fromtimestamp(end_time).strftime('%Y-%m-%d %H:%M:%S')
33
  duration = end_time - start_time
34
-
35
  # Write to file (works in Colab)
36
- with open('content/logs.txt', 'a') as f:
37
  f.write(f"{func.__name__}, start: {start_str}, end: {end_str}, duration: {duration:.4f}s\n")
38
-
39
  # Also print to see output immediately
40
  print(f"{func.__name__}, start: {start_str}, end: {end_str}, duration: {duration:.4f}s")
41
-
42
  return result
43
  return wrapper
44
 
@@ -115,7 +115,7 @@ class ComicImageGenerator:
115
  data_url = f"data:image/png;base64,{img_b64}"
116
 
117
  return placeholder, data_url
118
-
119
  @log_execution
120
  def _create_comic_prompt(self, title, description, characters=None, settings=None, style=None, num_scenes=1):
121
  """
 
25
  def wrapper(*args, **kwargs):
26
  start_time = time.time()
27
  start_str = datetime.fromtimestamp(start_time).strftime('%Y-%m-%d %H:%M:%S')
28
+
29
  result = func(*args, **kwargs)
30
+
31
  end_time = time.time()
32
  end_str = datetime.fromtimestamp(end_time).strftime('%Y-%m-%d %H:%M:%S')
33
  duration = end_time - start_time
34
+
35
  # Write to file (works in Colab)
36
+ with open('content/logs.txt', 'w') as f:
37
  f.write(f"{func.__name__}, start: {start_str}, end: {end_str}, duration: {duration:.4f}s\n")
38
+
39
  # Also print to see output immediately
40
  print(f"{func.__name__}, start: {start_str}, end: {end_str}, duration: {duration:.4f}s")
41
+
42
  return result
43
  return wrapper
44
 
 
115
  data_url = f"data:image/png;base64,{img_b64}"
116
 
117
  return placeholder, data_url
118
+
119
  @log_execution
120
  def _create_comic_prompt(self, title, description, characters=None, settings=None, style=None, num_scenes=1):
121
  """
models/image_generation.py CHANGED
@@ -26,7 +26,7 @@ def log_execution(func):
26
  duration = end_time - start_time
27
 
28
  # Write to file (works in Colab)
29
- with open('content/logs.txt', 'a') as f:
30
  f.write(f"{func.__name__}, start: {start_str}, end: {end_str}, duration: {duration:.4f}s\n")
31
 
32
  # Also print to see output immediately
 
26
  duration = end_time - start_time
27
 
28
  # Write to file (works in Colab)
29
+ with open('content/logs.txt', 'w') as f:
30
  f.write(f"{func.__name__}, start: {start_str}, end: {end_str}, duration: {duration:.4f}s\n")
31
 
32
  # Also print to see output immediately
models/story_generator.py CHANGED
@@ -21,7 +21,7 @@ def log_execution(func):
21
  duration = end_time - start_time
22
 
23
  # Write to file (works in Colab)
24
- with open('content/logs.txt', 'a') as f:
25
  f.write(f"{func.__name__}, start: {start_str}, end: {end_str}, duration: {duration:.4f}s\n")
26
 
27
  # Also print to see output immediately
 
21
  duration = end_time - start_time
22
 
23
  # Write to file (works in Colab)
24
+ with open('content/logs.txt', 'w') as f:
25
  f.write(f"{func.__name__}, start: {start_str}, end: {end_str}, duration: {duration:.4f}s\n")
26
 
27
  # Also print to see output immediately