Spaces:
				
			
			
	
			
			
					
		Running
		
			on 
			
			CPU Upgrade
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
			on 
			
			CPU Upgrade
	Commit 
							
							·
						
						9eaf22a
	
1
								Parent(s):
							
							e64875c
								
fix fal login
Browse files- app.py +12 -0
 - index.html +17 -22
 
    	
        app.py
    CHANGED
    
    | 
         @@ -231,6 +231,18 @@ async def auth_exchange(request: Request, code: str, state: str, hf_oauth_state: 
     | 
|
| 231 | 
         
             
                        "namespace": user_info["username"]
         
     | 
| 232 | 
         
             
                    })
         
     | 
| 233 | 
         
             
                    response.delete_cookie("hf_oauth_state")
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 234 | 
         
             
                    return response
         
     | 
| 235 | 
         | 
| 236 | 
         
             
                except Exception as e:
         
     | 
| 
         | 
|
| 231 | 
         
             
                        "namespace": user_info["username"]
         
     | 
| 232 | 
         
             
                    })
         
     | 
| 233 | 
         
             
                    response.delete_cookie("hf_oauth_state")
         
     | 
| 234 | 
         
            +
             
     | 
| 235 | 
         
            +
                    # Also set access_token cookie for WebSocket authentication
         
     | 
| 236 | 
         
            +
                    response.set_cookie(
         
     | 
| 237 | 
         
            +
                        key="access_token",
         
     | 
| 238 | 
         
            +
                        value=access_token,
         
     | 
| 239 | 
         
            +
                        httponly=True,
         
     | 
| 240 | 
         
            +
                        samesite="none",
         
     | 
| 241 | 
         
            +
                        secure=True,
         
     | 
| 242 | 
         
            +
                        max_age=30 * 24 * 60 * 60,
         
     | 
| 243 | 
         
            +
                        path="/"
         
     | 
| 244 | 
         
            +
                    )
         
     | 
| 245 | 
         
            +
             
     | 
| 246 | 
         
             
                    return response
         
     | 
| 247 | 
         | 
| 248 | 
         
             
                except Exception as e:
         
     | 
    	
        index.html
    CHANGED
    
    | 
         @@ -154,7 +154,7 @@ 
     | 
|
| 154 | 
         
             
                        border-radius: 8px;
         
     | 
| 155 | 
         
             
                        border: 1px solid #d6d3d1;
         
     | 
| 156 | 
         
             
                        padding: 15px 20px;
         
     | 
| 157 | 
         
            -
                        margin- 
     | 
| 158 | 
         
             
                        display: flex;
         
     | 
| 159 | 
         
             
                        justify-content: space-between;
         
     | 
| 160 | 
         
             
                        align-items: center;
         
     | 
| 
         @@ -552,21 +552,6 @@ 
     | 
|
| 552 | 
         | 
| 553 | 
         
             
                    <!-- App Container (Grayed out when not authenticated) -->
         
     | 
| 554 | 
         
             
                    <div id="appContainer">
         
     | 
| 555 | 
         
            -
                        <!-- User Bar (Hidden when not authenticated) -->
         
     | 
| 556 | 
         
            -
                        <div id="userBar" class="user-bar hidden">
         
     | 
| 557 | 
         
            -
                            <div class="user-info">
         
     | 
| 558 | 
         
            -
                                <img id="userAvatar" src="" alt="Avatar" class="user-avatar">
         
     | 
| 559 | 
         
            -
                                <div class="user-details">
         
     | 
| 560 | 
         
            -
                                    <h3 id="userFullname" style="font-size: 1rem; margin-bottom: 3px;"></h3>
         
     | 
| 561 | 
         
            -
                                    <span id="userBadge" class="user-badge"></span>
         
     | 
| 562 | 
         
            -
                                </div>
         
     | 
| 563 | 
         
            -
                            </div>
         
     | 
| 564 | 
         
            -
                            <div style="text-align: right;">
         
     | 
| 565 | 
         
            -
                                <div id="usageInfo" class="usage-info" style="font-size: 0.85rem; color: #78716c;"></div>
         
     | 
| 566 | 
         
            -
                                <button class="btn-logout" onclick="auth.logout()">Logout</button>
         
     | 
| 567 | 
         
            -
                            </div>
         
     | 
| 568 | 
         
            -
                        </div>
         
     | 
| 569 | 
         
            -
             
     | 
| 570 | 
         
             
                        <!-- Limit Warning (Hidden by default) -->
         
     | 
| 571 | 
         
             
                        <div id="limitWarning" class="limit-warning hidden">
         
     | 
| 572 | 
         
             
                            <h3 style="color: #991b1b; margin-bottom: 10px;">Daily Limit Reached</h3>
         
     | 
| 
         @@ -582,8 +567,9 @@ 
     | 
|
| 582 | 
         
             
                                <a href="https://huggingface.co/krea/krea-realtime-video" target="_blank" class="header-link">Model on Hugging Face</a>
         
     | 
| 583 | 
         
             
                                <span style="color: #d6d3d1;">•</span>
         
     | 
| 584 | 
         
             
                                <a href="https://github.com/krea-ai/realtime-video" target="_blank" class="header-link">GitHub Repository</a>
         
     | 
| 
         | 
|
| 
         | 
|
| 585 | 
         
             
                            </div>
         
     | 
| 586 | 
         
            -
                            <p class="subtitle">Self-Forcing Diffusion with Dynamic Prompt Rewriting • 832×480 Fixed Resolution</p>
         
     | 
| 587 | 
         
             
                        </header>
         
     | 
| 588 | 
         | 
| 589 | 
         
             
                        <!-- Video Grid: Webcam Left, Output Right -->
         
     | 
| 
         @@ -708,6 +694,20 @@ 
     | 
|
| 708 | 
         
             
                            <div id="errorBox" class="error-box hidden"></div>
         
     | 
| 709 | 
         
             
                            <div id="infoBox" class="info-box hidden"></div>
         
     | 
| 710 | 
         
             
                        </div>
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 711 | 
         
             
                    </div>
         
     | 
| 712 | 
         
             
                </div>
         
     | 
| 713 | 
         | 
| 
         @@ -822,9 +822,6 @@ 
     | 
|
| 822 | 
         
             
                            badge.textContent = this.user.is_pro ? 'PRO' : 'FREE';
         
     | 
| 823 | 
         
             
                            badge.className = 'user-badge ' + (this.user.is_pro ? 'badge-pro' : 'badge-free');
         
     | 
| 824 | 
         | 
| 825 | 
         
            -
                            document.getElementById('usageInfo').textContent =
         
     | 
| 826 | 
         
            -
                                `Generations: ${this.sessionsUsed}/${this.sessionsLimit} today`;
         
     | 
| 827 | 
         
            -
             
     | 
| 828 | 
         
             
                            // Show/hide limit warning
         
     | 
| 829 | 
         
             
                            if (!this.canStart) {
         
     | 
| 830 | 
         
             
                                document.getElementById('limitWarning').classList.remove('hidden');
         
     | 
| 
         @@ -1139,8 +1136,6 @@ 
     | 
|
| 1139 | 
         
             
                                    auth.sessionsUsed = sessionData.sessions_used;
         
     | 
| 1140 | 
         
             
                                    auth.sessionsLimit = sessionData.sessions_limit;
         
     | 
| 1141 | 
         
             
                                    auth.canStart = sessionData.sessions_used < sessionData.sessions_limit;
         
     | 
| 1142 | 
         
            -
                                    document.getElementById('usageInfo').textContent =
         
     | 
| 1143 | 
         
            -
                                        `Generations: ${auth.sessionsUsed}/${auth.sessionsLimit} today`;
         
     | 
| 1144 | 
         
             
                                } catch (error) {
         
     | 
| 1145 | 
         
             
                                    this.showError('Failed to start session');
         
     | 
| 1146 | 
         
             
                                    return;
         
     | 
| 
         | 
|
| 154 | 
         
             
                        border-radius: 8px;
         
     | 
| 155 | 
         
             
                        border: 1px solid #d6d3d1;
         
     | 
| 156 | 
         
             
                        padding: 15px 20px;
         
     | 
| 157 | 
         
            +
                        margin-top: 20px;
         
     | 
| 158 | 
         
             
                        display: flex;
         
     | 
| 159 | 
         
             
                        justify-content: space-between;
         
     | 
| 160 | 
         
             
                        align-items: center;
         
     | 
| 
         | 
|
| 552 | 
         | 
| 553 | 
         
             
                    <!-- App Container (Grayed out when not authenticated) -->
         
     | 
| 554 | 
         
             
                    <div id="appContainer">
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 555 | 
         
             
                        <!-- Limit Warning (Hidden by default) -->
         
     | 
| 556 | 
         
             
                        <div id="limitWarning" class="limit-warning hidden">
         
     | 
| 557 | 
         
             
                            <h3 style="color: #991b1b; margin-bottom: 10px;">Daily Limit Reached</h3>
         
     | 
| 
         | 
|
| 567 | 
         
             
                                <a href="https://huggingface.co/krea/krea-realtime-video" target="_blank" class="header-link">Model on Hugging Face</a>
         
     | 
| 568 | 
         
             
                                <span style="color: #d6d3d1;">•</span>
         
     | 
| 569 | 
         
             
                                <a href="https://github.com/krea-ai/realtime-video" target="_blank" class="header-link">GitHub Repository</a>
         
     | 
| 570 | 
         
            +
                                <span style="color: #d6d3d1;">•</span>
         
     | 
| 571 | 
         
            +
                                <a href="https://fal.ai/models/fal-ai/krea/realtime-video" target="_blank" class="header-link">FAL API</a>
         
     | 
| 572 | 
         
             
                            </div>
         
     | 
| 
         | 
|
| 573 | 
         
             
                        </header>
         
     | 
| 574 | 
         | 
| 575 | 
         
             
                        <!-- Video Grid: Webcam Left, Output Right -->
         
     | 
| 
         | 
|
| 694 | 
         
             
                            <div id="errorBox" class="error-box hidden"></div>
         
     | 
| 695 | 
         
             
                            <div id="infoBox" class="info-box hidden"></div>
         
     | 
| 696 | 
         
             
                        </div>
         
     | 
| 697 | 
         
            +
             
     | 
| 698 | 
         
            +
                        <!-- User Bar (Hidden when not authenticated) -->
         
     | 
| 699 | 
         
            +
                        <div id="userBar" class="user-bar hidden">
         
     | 
| 700 | 
         
            +
                            <div class="user-info">
         
     | 
| 701 | 
         
            +
                                <img id="userAvatar" src="" alt="Avatar" class="user-avatar">
         
     | 
| 702 | 
         
            +
                                <div class="user-details">
         
     | 
| 703 | 
         
            +
                                    <h3 id="userFullname" style="font-size: 1rem; margin-bottom: 3px;"></h3>
         
     | 
| 704 | 
         
            +
                                    <span id="userBadge" class="user-badge"></span>
         
     | 
| 705 | 
         
            +
                                </div>
         
     | 
| 706 | 
         
            +
                            </div>
         
     | 
| 707 | 
         
            +
                            <div style="text-align: right;">
         
     | 
| 708 | 
         
            +
                                <button class="btn-logout" onclick="auth.logout()">Logout</button>
         
     | 
| 709 | 
         
            +
                            </div>
         
     | 
| 710 | 
         
            +
                        </div>
         
     | 
| 711 | 
         
             
                    </div>
         
     | 
| 712 | 
         
             
                </div>
         
     | 
| 713 | 
         | 
| 
         | 
|
| 822 | 
         
             
                            badge.textContent = this.user.is_pro ? 'PRO' : 'FREE';
         
     | 
| 823 | 
         
             
                            badge.className = 'user-badge ' + (this.user.is_pro ? 'badge-pro' : 'badge-free');
         
     | 
| 824 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 825 | 
         
             
                            // Show/hide limit warning
         
     | 
| 826 | 
         
             
                            if (!this.canStart) {
         
     | 
| 827 | 
         
             
                                document.getElementById('limitWarning').classList.remove('hidden');
         
     | 
| 
         | 
|
| 1136 | 
         
             
                                    auth.sessionsUsed = sessionData.sessions_used;
         
     | 
| 1137 | 
         
             
                                    auth.sessionsLimit = sessionData.sessions_limit;
         
     | 
| 1138 | 
         
             
                                    auth.canStart = sessionData.sessions_used < sessionData.sessions_limit;
         
     | 
| 
         | 
|
| 
         | 
|
| 1139 | 
         
             
                                } catch (error) {
         
     | 
| 1140 | 
         
             
                                    this.showError('Failed to start session');
         
     | 
| 1141 | 
         
             
                                    return;
         
     |