moreiraj93 commited on
Commit
4df1618
ยท
verified ยท
1 Parent(s): 0593dfc

# AI Vision Studio ๐ŸŽจ

Browse files

A fully functional HTML website for AI-powered image generation featuring Image-to-Image and Text-to-Image capabilities with real-time community features, authentication, and Hugging Face integration.

## โœจ Features

### ๐Ÿ–ผ๏ธ AI Image Generation
- **Image-to-Image Transformation**: Upload images and transform them with AI using style prompts
- **Text-to-Image Generation**: Create images from text descriptions with customizable styles
- **Style Controls**: Adjustable strength, multiple style options, and size selection
- **Real-time Results**: Instant preview of generated images with download and share options

### ๐ŸŽจ Black & Pink Theme
- Modern dark theme with vibrant pink accents
- Responsive design that works on all devices
- Smooth animations and transitions
- Custom scrollbars and interactive elements

### ๐Ÿ‘ฅ Community Features
- **Real-time Community Feed**: Live updates of user creations and activities
- **Interactive Gallery**: Browse and like community-generated artwork
- **Live Activity Stream**: Real-time notifications of community actions
- **Filtering Options**: Sort by recent, trending, or featured content

### ๐Ÿ” Authentication System
- User registration and login functionality
- Profile management with avatars
- Credit system for image generations
- **Instant Signup Rewards**: New users receive 100 free generations + premium features

### ๐ŸŽฌ Interactive Elements
- **Hero Slideshow**: Auto-advancing slides with videos and images
- **Smooth Navigation**: Scroll-based section highlighting
- **Modal System**: Clean popup interfaces for auth and image viewing
- **Toast Notifications**: Real-time feedback for user actions

## ๐Ÿš€ Quick Start

1. **Download Files**: Save all files to your web server directory
2. **Open Website**: Navigate to `index.html` in your browser
3. **Sign Up**: Create an account to receive 100 free generations
4. **Start Creating**: Use the Image-to-Image or Text-to-Image tools

## ๐Ÿ“ File Structure

```
ai-vision-studio/
โ”œโ”€โ”€ index.html # Main website structure
โ”œโ”€โ”€ styles.css # Complete styling with black/pink theme
โ”œโ”€โ”€ script.js # Interactive functionality and API integration
โ””โ”€โ”€ README.md # Documentation (this file)
```

## ๐Ÿ› ๏ธ Technical Implementation

### Frontend Technologies
- **HTML5**: Semantic markup with modern structure
- **CSS3**: Advanced styling with CSS Grid, Flexbox, and animations
- **Vanilla JavaScript**: No dependencies, pure JS functionality
- **Font Awesome**: Icon library for UI elements
- **Google Fonts**: Inter font family for modern typography

### Key JavaScript Features
- **Modular Architecture**: Organized code with clear separation of concerns
- **Local Storage**: Persistent user sessions and data
- **Canvas API**: Dynamic placeholder image generation
- **Event-driven**: Responsive to user interactions
- **Real-time Updates**: Simulated live community features

### Responsive Design
- **Mobile-first**: Optimized for mobile devices
- **Breakpoints**: 768px (tablet) and 480px (mobile)
- **Flexible Grid**: Auto-adjusting layouts
- **Touch-friendly**: Large clickable areas and smooth interactions

## ๐ŸŽฏ Core Functionality

### Image Generation Workflow

1. **Image-to-Image**:
```javascript
Upload Image โ†’ Add Style Prompt โ†’ Adjust Strength โ†’ Generate โ†’ View Results
```

2. **Text-to-Image**:
```javascript
Enter Text Prompt โ†’ Select Style โ†’ Choose Size โ†’ Generate โ†’ View Results
```

### Authentication Flow

1. **New User**:
```javascript
Sign Up โ†’ Instant Reward Popup โ†’ 100 Free Credits โ†’ Start Creating
```

2. **Returning User**:
```javascript
Login โ†’ Access Tools โ†’ Generate Images โ†’ Share to Community
```

### Community Integration

- **Real-time Feed**: Posts update automatically
- **Like System**: Interactive engagement with community content
- **Activity Stream**: Live updates of user actions
- **Share Feature**: One-click sharing of generated images

## ๐ŸŽจ Customization

### Color Scheme
The website uses CSS custom properties for easy theme customization:

```css
:root {
--primary-pink: #ff0080;
--secondary-pink: #ff3399;
--primary-black: #0a0a0a;
--secondary-black: #1a1a1a;
/* ... more variables */
}
```

### API Integration
To connect with real AI services, update these functions in `script.js`:

```javascript
// Replace placeholder functions with real API calls
async function generateImageToImage() {
// Add Hugging Face API integration
}

async function generateTextToImage() {
// Add Hugging Face API integration
}
```

## ๐Ÿ”ง Advanced Features

### Hugging Face Integration Ready
The codebase is prepared for Hugging Face API integration:

- API call structure in place
- Error handling implemented
- Loading states and user feedback
- Credit system for usage tracking

### Real-time Community
- Simulated real-time updates (ready for WebSocket integration)
- Activity feed with user interactions
- Community post management
- Like system with instant updates

### Performance Optimizations
- **Lazy Loading**: Images load on demand
- **Efficient DOM Manipulation**: Minimal reflows and repaints
- **Event Delegation**: Optimized event handling
- **CSS Animations**: Hardware-accelerated transitions

## ๐Ÿ“ฑ Responsive Features

### Mobile Experience
- **Touch Gestures**: Swipe-friendly interfaces
- **Optimized Layouts**: Stack elements vertically on small screens
- **Readable Text**: Appropriate font sizes for mobile
- **Fast Loading**: Optimized images and minimal dependencies

### Tablet Experience
- **Medium Layouts**: Balanced between mobile and desktop
- **Touch Targets**: Appropriate button sizes
- **Navigation**: Accessible menu systems

### Desktop Experience
- **Full Features**: All functionality available
- **Keyboard Shortcuts**: ESC to close modals
- **Hover Effects**: Rich interactive feedback
- **Multi-column Layouts**: Efficient use of screen space

## ๐ŸŽ‰ Signup Rewards System

New users receive an instant welcome bonus:

- **100 Free Generations**: Immediate credits for image creation
- **Premium Features Access**: Full feature set unlocked
- **Community Upload Rights**: Ability to share creations
- **Animated Popup**: Engaging reward presentation

## ๐Ÿ”ฎ Future Enhancements

### Planned Features
- **Real AI Integration**: Connect to actual Hugging Face models
- **User Profiles**: Extended profile customization
- **Collections**: Organize favorite images
- **Advanced Filters**: More sophisticated image processing
- **Social Features**: Follow users, comments, and messaging

### Technical Improvements
- **Backend Integration**: User management and data persistence
- **WebSocket Support**: True real-time community features
- **Image Storage**: Cloud-based image hosting
- **Analytics**: User behavior tracking and insights

## ๐Ÿ“Š Browser Support

- **Chrome**: Full support (recommended)
- **Firefox**: Full support
- **Safari**: Full support
- **Edge**: Full support
- **Mobile Browsers**: Optimized experience

## ๐Ÿ›ก๏ธ Security Considerations

- **Client-side Validation**: Input sanitization
- **XSS Prevention**: Safe DOM manipulation
- **HTTPS Ready**: Secure connection support
- **Local Storage**: Secure user data handling

## ๐Ÿค Contributing

The codebase is structured for easy enhancement:

1. **Modular JavaScript**: Add new features in separate functions
2. **CSS Variables**: Customize theme by updating CSS custom properties
3. **Component Structure**: HTML sections are clearly organized
4. **Documentation**: Code is well-commented for easy understanding

## ๐Ÿ“ž Support

For questions or issues:
- Review the code comments for implementation details
- Check browser console for debugging information
- Ensure all files are properly served (not file:// protocol)
- Verify internet connection for external resources

---

**AI Vision Studio** - Empowering creativity through artificial intelligence ๐Ÿš€โœจ

Built with โค๏ธ using modern web technologies and designed for the future of AI-powered content creation.

Files changed (4) hide show
  1. components/auth-modal.js +181 -0
  2. index.html +17 -3
  3. script.js +75 -1
  4. style.css +13 -0
components/auth-modal.js ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class AuthModal extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ .modal {
7
+ position: fixed;
8
+ top: 0;
9
+ left: 0;
10
+ right: 0;
11
+ bottom: 0;
12
+ background: rgba(0, 0, 0, 0.8);
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ z-index: 1000;
17
+ opacity: 0;
18
+ pointer-events: none;
19
+ transition: opacity 0.3s ease;
20
+ }
21
+
22
+ .modal.active {
23
+ opacity: 1;
24
+ pointer-events: all;
25
+ }
26
+
27
+ .modal-content {
28
+ background: var(--secondary-black);
29
+ border-radius: var(--border-radius);
30
+ padding: 2rem;
31
+ width: 90%;
32
+ max-width: 400px;
33
+ box-shadow: var(--shadow-dark);
34
+ transform: translateY(20px);
35
+ transition: transform 0.3s ease;
36
+ }
37
+
38
+ .modal.active .modal-content {
39
+ transform: translateY(0);
40
+ }
41
+
42
+ .modal-header {
43
+ display: flex;
44
+ justify-content: space-between;
45
+ align-items: center;
46
+ margin-bottom: 1.5rem;
47
+ }
48
+
49
+ .modal-title {
50
+ font-size: 1.5rem;
51
+ font-weight: 600;
52
+ color: var(--text-white);
53
+ }
54
+
55
+ .close-btn {
56
+ background: none;
57
+ border: none;
58
+ color: var(--text-gray);
59
+ font-size: 1.5rem;
60
+ cursor: pointer;
61
+ }
62
+
63
+ .auth-form {
64
+ display: flex;
65
+ flex-direction: column;
66
+ gap: 1rem;
67
+ }
68
+
69
+ .form-group {
70
+ display: flex;
71
+ flex-direction: column;
72
+ gap: 0.5rem;
73
+ }
74
+
75
+ .form-label {
76
+ font-size: 0.875rem;
77
+ color: var(--text-gray);
78
+ }
79
+
80
+ .form-input {
81
+ padding: 0.75rem;
82
+ border-radius: 6px;
83
+ border: 1px solid var(--tertiary-black);
84
+ background: var(--primary-black);
85
+ color: var(--text-white);
86
+ }
87
+
88
+ .submit-btn {
89
+ background: var(--primary-pink);
90
+ color: white;
91
+ padding: 0.75rem;
92
+ border: none;
93
+ border-radius: 6px;
94
+ font-weight: 600;
95
+ cursor: pointer;
96
+ margin-top: 1rem;
97
+ transition: var(--transition);
98
+ }
99
+
100
+ .submit-btn:hover {
101
+ background: var(--secondary-pink);
102
+ }
103
+
104
+ .auth-switch {
105
+ text-align: center;
106
+ margin-top: 1rem;
107
+ color: var(--text-gray);
108
+ font-size: 0.875rem;
109
+ }
110
+
111
+ .auth-switch-btn {
112
+ color: var(--primary-pink);
113
+ background: none;
114
+ border: none;
115
+ cursor: pointer;
116
+ }
117
+ </style>
118
+
119
+ <div class="modal" id="auth-modal">
120
+ <div class="modal-content">
121
+ <div class="modal-header">
122
+ <h3 class="modal-title" id="modal-title">Sign In</h3>
123
+ <button class="close-btn" id="close-modal">&times;</button>
124
+ </div>
125
+ <form class="auth-form" id="auth-form">
126
+ <div class="form-group">
127
+ <label class="form-label">Email</label>
128
+ <input type="email" class="form-input" required>
129
+ </div>
130
+ <div class="form-group">
131
+ <label class="form-label">Password</label>
132
+ <input type="password" class="form-input" required>
133
+ </div>
134
+ <button type="submit" class="submit-btn">Continue</button>
135
+ </form>
136
+ <div class="auth-switch">
137
+ <span id="switch-text">Don't have an account?</span>
138
+ <button class="auth-switch-btn" id="switch-btn">Sign up</button>
139
+ </div>
140
+ </div>
141
+ </div>
142
+ `;
143
+
144
+ this.shadowRoot.getElementById('close-modal').addEventListener('click', () => {
145
+ this.hide();
146
+ });
147
+
148
+ this.shadowRoot.getElementById('switch-btn').addEventListener('click', () => {
149
+ this.toggleAuthMode();
150
+ });
151
+ }
152
+
153
+ show() {
154
+ this.shadowRoot.getElementById('auth-modal').classList.add('active');
155
+ }
156
+
157
+ hide() {
158
+ this.shadowRoot.getElementById('auth-modal').classList.remove('active');
159
+ }
160
+
161
+ toggleAuthMode() {
162
+ const title = this.shadowRoot.getElementById('modal-title');
163
+ const submitBtn = this.shadowRoot.querySelector('.submit-btn');
164
+ const switchText = this.shadowRoot.getElementById('switch-text');
165
+ const switchBtn = this.shadowRoot.getElementById('switch-btn');
166
+
167
+ if (title.textContent === 'Sign In') {
168
+ title.textContent = 'Sign Up';
169
+ submitBtn.textContent = 'Create Account';
170
+ switchText.textContent = 'Already have an account?';
171
+ switchBtn.textContent = 'Sign in';
172
+ } else {
173
+ title.textContent = 'Sign In';
174
+ submitBtn.textContent = 'Continue';
175
+ switchText.textContent = 'Don\'t have an account?';
176
+ switchBtn.textContent = 'Sign up';
177
+ }
178
+ }
179
+ }
180
+
181
+ customElements.define('auth-modal', AuthModal);
index.html CHANGED
@@ -46,9 +46,9 @@
46
  </script>
47
  </head>
48
  <body class="bg-primary-black text-white">
 
49
  <custom-navbar></custom-navbar>
50
-
51
- <main class="container mx-auto px-4 py-8">
52
  <!-- Feature Banners -->
53
  <div class="space-y-4 mb-6">
54
  <div class="p-4 bg-gradient-to-r from-primary-pink/10 to-secondary-pink/10 rounded-lg border border-primary-pink/20">
@@ -238,9 +238,23 @@ Try Batch Processing
238
  </div>
239
  </div>
240
  </main>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
 
242
  <custom-footer></custom-footer>
243
-
244
  <script src="script.js"></script>
245
  <script>
246
  feather.replace();
 
46
  </script>
47
  </head>
48
  <body class="bg-primary-black text-white">
49
+ <auth-modal></auth-modal>
50
  <custom-navbar></custom-navbar>
51
+ <main class="container mx-auto px-4 py-8">
 
52
  <!-- Feature Banners -->
53
  <div class="space-y-4 mb-6">
54
  <div class="p-4 bg-gradient-to-r from-primary-pink/10 to-secondary-pink/10 rounded-lg border border-primary-pink/20">
 
238
  </div>
239
  </div>
240
  </main>
241
+ <!-- Community Feed Section -->
242
+ <section class="bg-secondary-black py-12 px-4">
243
+ <div class="container mx-auto">
244
+ <h2 class="text-3xl font-bold mb-8 text-center text-white">Community Creations</h2>
245
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6" id="community-feed">
246
+ <!-- Feed items will be populated by JavaScript -->
247
+ </div>
248
+ <div class="text-center mt-8">
249
+ <button id="load-more" class="bg-primary-pink hover:bg-secondary-pink text-white px-6 py-3 rounded-lg font-medium transition-colors">
250
+ Load More
251
+ </button>
252
+ </div>
253
+ </div>
254
+ </section>
255
 
256
  <custom-footer></custom-footer>
257
+ <script src="components/auth-modal.js"></script>
258
  <script src="script.js"></script>
259
  <script>
260
  feather.replace();
script.js CHANGED
@@ -1,7 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  document.addEventListener('DOMContentLoaded', function() {
 
 
 
2
  // Tab functionality
3
  const tabs = document.querySelectorAll('[role="tab"]');
4
- const tabPanels = document.querySelectorAll('[role="tabpanel"]');
5
 
6
  tabs.forEach(tab => {
7
  tab.addEventListener('click', function() {
 
1
+
2
+ // Community feed data
3
+ const communityPosts = [
4
+ {
5
+ id: 1,
6
+ user: 'AI_Artist_42',
7
+ avatar: 'http://static.photos/people/200x200/1',
8
+ image: 'http://static.photos/abstract/640x360/1',
9
+ prompt: 'Cyberpunk city at night with neon lights',
10
+ likes: 142,
11
+ timestamp: '2 hours ago'
12
+ },
13
+ {
14
+ id: 2,
15
+ user: 'DigitalDreamer',
16
+ avatar: 'http://static.photos/people/200x200/2',
17
+ image: 'http://static.photos/abstract/640x360/2',
18
+ prompt: 'Surreal landscape with floating islands',
19
+ likes: 89,
20
+ timestamp: '5 hours ago'
21
+ },
22
+ {
23
+ id: 3,
24
+ user: 'PixelPioneer',
25
+ avatar: 'http://static.photos/people/200x200/3',
26
+ image: 'http://static.photos/abstract/640x360/3',
27
+ prompt: 'Portrait of a robot with human emotions',
28
+ likes: 217,
29
+ timestamp: '1 day ago'
30
+ }
31
+ ];
32
+
33
+ // Render community feed
34
+ function renderCommunityFeed() {
35
+ const feedContainer = document.getElementById('community-feed');
36
+ feedContainer.innerHTML = '';
37
+
38
+ communityPosts.forEach(post => {
39
+ const postElement = document.createElement('div');
40
+ postElement.className = 'bg-tertiary-black rounded-lg overflow-hidden shadow-lg transition-transform hover:scale-105';
41
+ postElement.innerHTML = `
42
+ <div class="relative">
43
+ <img src="${post.image}" alt="${post.prompt}" class="w-full h-64 object-cover">
44
+ <div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent p-4">
45
+ <p class="text-white font-medium">${post.prompt}</p>
46
+ </div>
47
+ </div>
48
+ <div class="p-4">
49
+ <div class="flex items-center gap-3 mb-3">
50
+ <img src="${post.avatar}" alt="${post.user}" class="w-10 h-10 rounded-full">
51
+ <div>
52
+ <p class="font-medium text-white">${post.user}</p>
53
+ <p class="text-xs text-gray-400">${post.timestamp}</p>
54
+ </div>
55
+ </div>
56
+ <div class="flex justify-between items-center">
57
+ <button class="flex items-center gap-1 text-primary-pink">
58
+ <i data-feather="heart"></i>
59
+ <span>${post.likes}</span>
60
+ </button>
61
+ <button class="text-gray-400 hover:text-white">
62
+ <i data-feather="share-2"></i>
63
+ </button>
64
+ </div>
65
+ </div>
66
+ `;
67
+ feedContainer.appendChild(postElement);
68
+ });
69
+ feather.replace();
70
+ }
71
+
72
  document.addEventListener('DOMContentLoaded', function() {
73
+ // Initialize community feed
74
+ renderCommunityFeed();
75
+
76
  // Tab functionality
77
  const tabs = document.querySelectorAll('[role="tab"]');
78
+ const tabPanels = document.querySelectorAll('[role="tabpanel"]');
79
 
80
  tabs.forEach(tab => {
81
  tab.addEventListener('click', function() {
style.css CHANGED
@@ -38,6 +38,19 @@ body {
38
  border-bottom-color: var(--primary-pink);
39
  color: var(--primary-pink);
40
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  /* Animation for generated results */
43
  @keyframes fadeIn {
 
38
  border-bottom-color: var(--primary-pink);
39
  color: var(--primary-pink);
40
  }
41
+ /* Community Feed Styles */
42
+ #community-feed {
43
+ animation: fadeIn 0.5s ease-out;
44
+ }
45
+
46
+ .community-post {
47
+ transition: var(--transition);
48
+ }
49
+
50
+ .community-post:hover {
51
+ transform: translateY(-5px);
52
+ box-shadow: var(--shadow-pink);
53
+ }
54
 
55
  /* Animation for generated results */
56
  @keyframes fadeIn {