Spaces:
Sleeping
Sleeping
Yuvvan Talreja commited on
Commit ·
422dc44
1
Parent(s): 9fb2346
Upload fix
Browse files- static/script.js +51 -31
- static/styles.css +0 -30
- templates/index.html +1 -7
static/script.js
CHANGED
|
@@ -299,24 +299,24 @@ fileInput.addEventListener('change', (e) => {
|
|
| 299 |
}
|
| 300 |
|
| 301 |
try {
|
| 302 |
-
|
| 303 |
console.log("Created video URL:", videoURL);
|
| 304 |
|
| 305 |
-
|
| 306 |
videoPlayer.load(); // Force reload
|
| 307 |
|
| 308 |
// Update UI
|
| 309 |
-
|
| 310 |
-
|
| 311 |
transcriptionDiv.innerHTML = '';
|
| 312 |
topicResultsDiv.innerHTML = '';
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
// Reset progress
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
}
|
| 321 |
|
| 322 |
// Set active step
|
|
@@ -539,44 +539,44 @@ modelSelector.addEventListener('change', async (e) => {
|
|
| 539 |
window.addEventListener('DOMContentLoaded', () => {
|
| 540 |
// Initialize all UI components with error handling for each
|
| 541 |
try {
|
| 542 |
-
|
| 543 |
} catch (error) {
|
| 544 |
console.error('Failed to initialize theme toggle:', error);
|
| 545 |
}
|
| 546 |
|
| 547 |
try {
|
| 548 |
-
|
| 549 |
} catch (error) {
|
| 550 |
console.error('Failed to initialize FAB:', error);
|
| 551 |
}
|
| 552 |
|
| 553 |
try {
|
| 554 |
-
|
| 555 |
} catch (error) {
|
| 556 |
console.error('Failed to initialize gallery:', error);
|
| 557 |
}
|
| 558 |
|
| 559 |
try {
|
| 560 |
-
|
| 561 |
} catch (error) {
|
| 562 |
console.error('Failed to initialize custom video player:', error);
|
| 563 |
}
|
| 564 |
|
| 565 |
try {
|
| 566 |
-
|
| 567 |
} catch (error) {
|
| 568 |
console.error('Failed to initialize upload particles:', error);
|
| 569 |
}
|
| 570 |
|
| 571 |
try {
|
| 572 |
-
|
| 573 |
} catch (error) {
|
| 574 |
console.error('Failed to initialize progress steps:', error);
|
| 575 |
}
|
| 576 |
|
| 577 |
// Initialize mindmap system
|
| 578 |
try {
|
| 579 |
-
|
| 580 |
} catch (error) {
|
| 581 |
console.error('Failed to initialize mindmap:', error);
|
| 582 |
}
|
|
@@ -584,13 +584,13 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
| 584 |
// Check for model selector and initialize whisper if available
|
| 585 |
const modelSelector = document.getElementById('modelSelector');
|
| 586 |
if (modelSelector) {
|
| 587 |
-
|
| 588 |
-
|
| 589 |
const statusDiv = document.getElementById('status');
|
| 590 |
if (statusDiv) {
|
| 591 |
-
|
| 592 |
}
|
| 593 |
-
|
| 594 |
}
|
| 595 |
});
|
| 596 |
|
|
@@ -2200,15 +2200,41 @@ function initUploadParticles() {
|
|
| 2200 |
particles.appendChild(particle);
|
| 2201 |
}
|
| 2202 |
|
| 2203 |
-
// Add click event to trigger file input - FIXED VERSION
|
| 2204 |
uploadContainer.addEventListener('click', (e) => {
|
| 2205 |
-
|
| 2206 |
-
e.stopPropagation(); // Stop event from bubbling up
|
| 2207 |
console.log("Upload container clicked");
|
|
|
|
| 2208 |
fileInput.click();
|
| 2209 |
});
|
| 2210 |
|
| 2211 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2212 |
uploadContainer.addEventListener('dragover', (e) => {
|
| 2213 |
e.preventDefault();
|
| 2214 |
e.stopPropagation();
|
|
@@ -2236,12 +2262,6 @@ function initUploadParticles() {
|
|
| 2236 |
fileInput.dispatchEvent(event);
|
| 2237 |
}
|
| 2238 |
});
|
| 2239 |
-
|
| 2240 |
-
// Add logging to the file input change event for debugging
|
| 2241 |
-
fileInput.addEventListener('change', (e) => {
|
| 2242 |
-
console.log("File input change event fired", e.target.files);
|
| 2243 |
-
// The rest of the handler continues below...
|
| 2244 |
-
});
|
| 2245 |
}
|
| 2246 |
|
| 2247 |
// Progress Steps Visualization
|
|
|
|
| 299 |
}
|
| 300 |
|
| 301 |
try {
|
| 302 |
+
const videoURL = URL.createObjectURL(file);
|
| 303 |
console.log("Created video URL:", videoURL);
|
| 304 |
|
| 305 |
+
videoPlayer.src = videoURL;
|
| 306 |
videoPlayer.load(); // Force reload
|
| 307 |
|
| 308 |
// Update UI
|
| 309 |
+
transcribeButton.disabled = false;
|
| 310 |
+
analyzeButton.disabled = true;
|
| 311 |
transcriptionDiv.innerHTML = '';
|
| 312 |
topicResultsDiv.innerHTML = '';
|
| 313 |
+
transcriptText = '';
|
| 314 |
+
statusDiv.textContent = 'Video loaded. Ready to transcribe.';
|
| 315 |
+
|
| 316 |
// Reset progress
|
| 317 |
+
const progressBarFill = document.querySelector('.progress-bar-fill');
|
| 318 |
+
if (progressBarFill) {
|
| 319 |
+
progressBarFill.style.width = '0%';
|
| 320 |
}
|
| 321 |
|
| 322 |
// Set active step
|
|
|
|
| 539 |
window.addEventListener('DOMContentLoaded', () => {
|
| 540 |
// Initialize all UI components with error handling for each
|
| 541 |
try {
|
| 542 |
+
initThemeToggle();
|
| 543 |
} catch (error) {
|
| 544 |
console.error('Failed to initialize theme toggle:', error);
|
| 545 |
}
|
| 546 |
|
| 547 |
try {
|
| 548 |
+
initFAB();
|
| 549 |
} catch (error) {
|
| 550 |
console.error('Failed to initialize FAB:', error);
|
| 551 |
}
|
| 552 |
|
| 553 |
try {
|
| 554 |
+
initGallery();
|
| 555 |
} catch (error) {
|
| 556 |
console.error('Failed to initialize gallery:', error);
|
| 557 |
}
|
| 558 |
|
| 559 |
try {
|
| 560 |
+
initCustomVideoPlayer();
|
| 561 |
} catch (error) {
|
| 562 |
console.error('Failed to initialize custom video player:', error);
|
| 563 |
}
|
| 564 |
|
| 565 |
try {
|
| 566 |
+
initUploadParticles();
|
| 567 |
} catch (error) {
|
| 568 |
console.error('Failed to initialize upload particles:', error);
|
| 569 |
}
|
| 570 |
|
| 571 |
try {
|
| 572 |
+
initProgressSteps();
|
| 573 |
} catch (error) {
|
| 574 |
console.error('Failed to initialize progress steps:', error);
|
| 575 |
}
|
| 576 |
|
| 577 |
// Initialize mindmap system
|
| 578 |
try {
|
| 579 |
+
mindmap = new TopicMindmap();
|
| 580 |
} catch (error) {
|
| 581 |
console.error('Failed to initialize mindmap:', error);
|
| 582 |
}
|
|
|
|
| 584 |
// Check for model selector and initialize whisper if available
|
| 585 |
const modelSelector = document.getElementById('modelSelector');
|
| 586 |
if (modelSelector) {
|
| 587 |
+
initWhisper(modelSelector.value).catch(error => {
|
| 588 |
+
console.error('Failed to initialize Whisper:', error);
|
| 589 |
const statusDiv = document.getElementById('status');
|
| 590 |
if (statusDiv) {
|
| 591 |
+
statusDiv.textContent = 'Failed to initialize the transcription model';
|
| 592 |
}
|
| 593 |
+
});
|
| 594 |
}
|
| 595 |
});
|
| 596 |
|
|
|
|
| 2200 |
particles.appendChild(particle);
|
| 2201 |
}
|
| 2202 |
|
| 2203 |
+
// Add click event to trigger file input - PROPERLY FIXED VERSION
|
| 2204 |
uploadContainer.addEventListener('click', (e) => {
|
| 2205 |
+
// Don't prevent default on the click event here
|
|
|
|
| 2206 |
console.log("Upload container clicked");
|
| 2207 |
+
// Directly trigger the file input click
|
| 2208 |
fileInput.click();
|
| 2209 |
});
|
| 2210 |
|
| 2211 |
+
// Also add click handlers to the specific elements inside the container
|
| 2212 |
+
const uploadIcon = uploadContainer.querySelector('.upload-icon-container');
|
| 2213 |
+
const uploadText = uploadContainer.querySelector('.upload-text');
|
| 2214 |
+
const uploadSubtext = uploadContainer.querySelector('.upload-subtext');
|
| 2215 |
+
|
| 2216 |
+
if (uploadIcon) {
|
| 2217 |
+
uploadIcon.addEventListener('click', (e) => {
|
| 2218 |
+
console.log("Upload icon clicked");
|
| 2219 |
+
fileInput.click();
|
| 2220 |
+
});
|
| 2221 |
+
}
|
| 2222 |
+
|
| 2223 |
+
if (uploadText) {
|
| 2224 |
+
uploadText.addEventListener('click', (e) => {
|
| 2225 |
+
console.log("Upload text clicked");
|
| 2226 |
+
fileInput.click();
|
| 2227 |
+
});
|
| 2228 |
+
}
|
| 2229 |
+
|
| 2230 |
+
if (uploadSubtext) {
|
| 2231 |
+
uploadSubtext.addEventListener('click', (e) => {
|
| 2232 |
+
console.log("Upload subtext clicked");
|
| 2233 |
+
fileInput.click();
|
| 2234 |
+
});
|
| 2235 |
+
}
|
| 2236 |
+
|
| 2237 |
+
// Drag and drop functionality - keep these preventDefault calls
|
| 2238 |
uploadContainer.addEventListener('dragover', (e) => {
|
| 2239 |
e.preventDefault();
|
| 2240 |
e.stopPropagation();
|
|
|
|
| 2262 |
fileInput.dispatchEvent(event);
|
| 2263 |
}
|
| 2264 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2265 |
}
|
| 2266 |
|
| 2267 |
// Progress Steps Visualization
|
static/styles.css
CHANGED
|
@@ -1886,34 +1886,4 @@ jmnode.node-teal:hover, jmnode.node-gray:hover {
|
|
| 1886 |
|
| 1887 |
.transcription-content p:hover {
|
| 1888 |
background-color: rgba(52, 152, 219, 0.1);
|
| 1889 |
-
}
|
| 1890 |
-
|
| 1891 |
-
/* Hugging Face Badge Styles */
|
| 1892 |
-
.huggingface-badge {
|
| 1893 |
-
display: flex;
|
| 1894 |
-
align-items: center;
|
| 1895 |
-
gap: 0.5rem;
|
| 1896 |
-
margin-left: auto;
|
| 1897 |
-
padding: 0.5rem;
|
| 1898 |
-
border-radius: var(--radius-md);
|
| 1899 |
-
background-color: var(--background-color);
|
| 1900 |
-
transition: all 0.3s ease;
|
| 1901 |
-
}
|
| 1902 |
-
|
| 1903 |
-
.huggingface-badge span {
|
| 1904 |
-
font-size: 0.85rem;
|
| 1905 |
-
color: var(--text-secondary);
|
| 1906 |
-
}
|
| 1907 |
-
|
| 1908 |
-
.huggingface-badge img {
|
| 1909 |
-
height: 24px;
|
| 1910 |
-
}
|
| 1911 |
-
|
| 1912 |
-
.huggingface-badge:hover {
|
| 1913 |
-
transform: translateY(-2px);
|
| 1914 |
-
box-shadow: var(--shadow-sm);
|
| 1915 |
-
}
|
| 1916 |
-
|
| 1917 |
-
[data-theme="dark"] .huggingface-badge {
|
| 1918 |
-
background-color: var(--surface-color);
|
| 1919 |
}
|
|
|
|
| 1886 |
|
| 1887 |
.transcription-content p:hover {
|
| 1888 |
background-color: rgba(52, 152, 219, 0.1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1889 |
}
|
templates/index.html
CHANGED
|
@@ -16,12 +16,6 @@
|
|
| 16 |
<i class="fas fa-project-diagram logo-icon"></i>
|
| 17 |
<h1>Flowify</h1>
|
| 18 |
</div>
|
| 19 |
-
<div class="huggingface-badge">
|
| 20 |
-
<span>Powered by</span>
|
| 21 |
-
<a href="https://huggingface.co/spaces" target="_blank">
|
| 22 |
-
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/powered-by-huggingface-light.svg" alt="Powered by Hugging Face" />
|
| 23 |
-
</a>
|
| 24 |
-
</div>
|
| 25 |
</header>
|
| 26 |
|
| 27 |
<!-- Theme Toggle Button -->
|
|
@@ -38,7 +32,7 @@
|
|
| 38 |
<div class="upload-panel card">
|
| 39 |
<div class="card-body">
|
| 40 |
<div class="upload-section">
|
| 41 |
-
<div class="upload-container" id="dropZone"
|
| 42 |
<div class="particles">
|
| 43 |
<!-- Particles will be added dynamically via JS -->
|
| 44 |
</div>
|
|
|
|
| 16 |
<i class="fas fa-project-diagram logo-icon"></i>
|
| 17 |
<h1>Flowify</h1>
|
| 18 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</header>
|
| 20 |
|
| 21 |
<!-- Theme Toggle Button -->
|
|
|
|
| 32 |
<div class="upload-panel card">
|
| 33 |
<div class="card-body">
|
| 34 |
<div class="upload-section">
|
| 35 |
+
<div class="upload-container" id="dropZone">
|
| 36 |
<div class="particles">
|
| 37 |
<!-- Particles will be added dynamically via JS -->
|
| 38 |
</div>
|