Text-to-Image
Diffusers
English
File size: 2,222 Bytes
eaefa93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# import pygame
# import random

# # Initialize Pygame
# pygame.init()

# # Screen dimensions
# WIDTH, HEIGHT = 800, 600
# screen = pygame.display.set_mode((WIDTH, HEIGHT))
# pygame.display.set_caption("DDPM Noise Game")

# # Colors
# WHITE = (255, 255, 255)
# BLACK = (0, 0, 0)

# # Load image
# image = pygame.image.load("estelle-peplum-top-tops-509.webp")
# image = pygame.transform.scale(image, (300, 300))

# # Generate noise patterns
# def generate_noise_pattern():
#     pattern = pygame.Surface((300, 300), pygame.SRCALPHA)
#     for _ in range(50):  # Draw random lines
#         start = (random.randint(0, 300), random.randint(0, 300))
#         end = (random.randint(0, 300), random.randint(0, 300))
#         pygame.draw.line(pattern, BLACK, start, end, 2)
#     return pattern

# noise_patterns = [generate_noise_pattern() for _ in range(20)]

# # Task 1: Identify the Noise
# def task1():
#     noisy_image = image.copy()
#     current_noise = random.choice(noise_patterns)
#     noisy_image.blit(current_noise, (0, 0))

#     screen.fill(WHITE)
#     screen.blit(image, (50, 50))
#     screen.blit(noisy_image, (400, 50))
#     pygame.display.flip()

#     # Wait for user input
#     running = True
#     while running:
#         for event in pygame.event.get():
#             if event.type == pygame.QUIT:
#                 pygame.quit()
#                 return
#             if event.type == pygame.KEYDOWN:
#                 if event.key == pygame.K_1:  # Example: User selects pattern 1
#                     print("You selected Pattern 1")
#                     running = False

# # Task 2: Memorize the Sequence
# def task2():
#     sequence = random.sample(noise_patterns, 5)  # Random sequence of 5 patterns
#     for pattern in sequence:
#         screen.fill(WHITE)
#         screen.blit(image, (50, 50))
#         # noisy_image = image.copy()
#         # screen.blit(pattern, (0, 0))
#         screen.set_alpha(0)
#         screen.blit(pattern, (400, 50))
#         pygame.display.flip()
#         pygame.time.wait(1000)  # Show each pattern for 1 second

#     # Ask user to recall the sequence
#     print("Recall the sequence of patterns!")

# # Main loop
# task1()
# task2()
# pygame.quit()