Spaces:
Running
Running
Приложение для распознавания выделенной область на экране и автомотическго запись в текстовый файл. Приложение работает поверх других приложений
Browse files- README.md +8 -5
- index.html +243 -18
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: ScreenSnip Scribe 📝
|
| 3 |
+
colorFrom: purple
|
| 4 |
+
colorTo: purple
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://deepsite.hf.co).
|
index.html
CHANGED
|
@@ -1,19 +1,244 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ScreenSnip Scribe</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
| 12 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/tesseract.js/4.1.1/tesseract.min.js"></script>
|
| 13 |
+
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.waves.min.js"></script>
|
| 14 |
+
<style>
|
| 15 |
+
.selection-box {
|
| 16 |
+
position: absolute;
|
| 17 |
+
border: 2px dashed rgba(59, 130, 246, 0.8);
|
| 18 |
+
background-color: rgba(59, 130, 246, 0.2);
|
| 19 |
+
pointer-events: none;
|
| 20 |
+
z-index: 9999;
|
| 21 |
+
}
|
| 22 |
+
.overlay {
|
| 23 |
+
position: fixed;
|
| 24 |
+
top: 0;
|
| 25 |
+
left: 0;
|
| 26 |
+
right: 0;
|
| 27 |
+
bottom: 0;
|
| 28 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 29 |
+
z-index: 9998;
|
| 30 |
+
display: none;
|
| 31 |
+
}
|
| 32 |
+
</style>
|
| 33 |
+
</head>
|
| 34 |
+
<body class="bg-gray-900 text-gray-100 min-h-screen">
|
| 35 |
+
<div id="vanta-bg" class="fixed inset-0 z-0"></div>
|
| 36 |
+
<div class="relative z-10 container mx-auto px-4 py-12">
|
| 37 |
+
<header class="mb-12 text-center">
|
| 38 |
+
<h1 class="text-5xl font-bold mb-4 bg-clip-text text-transparent bg-gradient-to-r from-blue-400 to-purple-600">ScreenSnip Scribe</h1>
|
| 39 |
+
<p class="text-xl text-gray-300 max-w-2xl mx-auto">Capture any screen area and automatically save the text to a file with this magical OCR tool ✨</p>
|
| 40 |
+
</header>
|
| 41 |
+
|
| 42 |
+
<main class="bg-gray-800 bg-opacity-70 backdrop-blur-lg rounded-xl p-8 max-w-3xl mx-auto shadow-2xl border border-gray-700">
|
| 43 |
+
<div class="flex flex-col items-center">
|
| 44 |
+
<div class="w-full mb-8">
|
| 45 |
+
<div class="flex items-center justify-center gap-4 mb-6">
|
| 46 |
+
<button id="startCaptureBtn" class="px-6 py-3 bg-blue-600 hover:bg-blue-700 rounded-lg font-medium flex items-center gap-2 transition-all transform hover:scale-105">
|
| 47 |
+
<i data-feather="crop"></i> Start Capture
|
| 48 |
+
</button>
|
| 49 |
+
<button id="saveBtn" disabled class="px-6 py-3 bg-purple-600 hover:bg-purple-700 rounded-lg font-medium flex items-center gap-2 transition-all opacity-70">
|
| 50 |
+
<i data-feather="save"></i> Save Text
|
| 51 |
+
</button>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="bg-gray-900 rounded-lg p-4 min-h-40 max-h-96 overflow-y-auto">
|
| 55 |
+
<h3 class="text-lg font-medium mb-3 text-blue-400">Extracted Text:</h3>
|
| 56 |
+
<div id="extractedText" class="text-gray-300 whitespace-pre-wrap"></div>
|
| 57 |
+
</div>
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
<div class="w-full">
|
| 61 |
+
<div class="bg-gray-900 rounded-lg p-4">
|
| 62 |
+
<div class="flex items-center justify-between mb-3">
|
| 63 |
+
<h3 class="text-lg font-medium text-blue-400">Settings</h3>
|
| 64 |
+
<i data-feather="settings" class="text-gray-400"></i>
|
| 65 |
+
</div>
|
| 66 |
+
|
| 67 |
+
<div class="space-y-4">
|
| 68 |
+
<div>
|
| 69 |
+
<label class="block text-sm font-medium text-gray-300 mb-1">Output Format</label>
|
| 70 |
+
<select id="outputFormat" class="w-full bg-gray-800 border border-gray-700 rounded-md px-3 py-2 text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 71 |
+
<option value="txt">Text File (.txt)</option>
|
| 72 |
+
<option value="doc">Word Document (.doc)</option>
|
| 73 |
+
<option value="pdf">PDF (.pdf)</option>
|
| 74 |
+
</select>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<div>
|
| 78 |
+
<label class="block text-sm font-medium text-gray-300 mb-1">Auto Save Location</label>
|
| 79 |
+
<div class="flex gap-2">
|
| 80 |
+
<input type="text" id="savePath" class="flex-1 bg-gray-800 border border-gray-700 rounded-md px-3 py-2 text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="C:/ScreenCaptures/" readonly>
|
| 81 |
+
<button id="changePathBtn" class="px-3 py-2 bg-gray-700 hover:bg-gray-600 rounded-md text-sm font-medium transition-colors">
|
| 82 |
+
<i data-feather="folder"></i>
|
| 83 |
+
</button>
|
| 84 |
+
</div>
|
| 85 |
+
</div>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
</main>
|
| 91 |
+
|
| 92 |
+
<div id="overlay" class="overlay"></div>
|
| 93 |
+
<div id="selectionBox" class="selection-box"></div>
|
| 94 |
+
</div>
|
| 95 |
+
|
| 96 |
+
<script>
|
| 97 |
+
// Initialize Vanta.js background
|
| 98 |
+
VANTA.WAVES({
|
| 99 |
+
el: "#vanta-bg",
|
| 100 |
+
mouseControls: true,
|
| 101 |
+
touchControls: true,
|
| 102 |
+
gyroControls: false,
|
| 103 |
+
minHeight: 200.00,
|
| 104 |
+
minWidth: 200.00,
|
| 105 |
+
scale: 1.00,
|
| 106 |
+
scaleMobile: 1.00,
|
| 107 |
+
color: 0x1e3a8a,
|
| 108 |
+
shininess: 50.00,
|
| 109 |
+
waveHeight: 20.00,
|
| 110 |
+
waveSpeed: 0.50,
|
| 111 |
+
zoom: 0.75
|
| 112 |
+
});
|
| 113 |
+
|
| 114 |
+
// Initialize feather icons
|
| 115 |
+
feather.replace();
|
| 116 |
+
|
| 117 |
+
// App functionality
|
| 118 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 119 |
+
const startCaptureBtn = document.getElementById('startCaptureBtn');
|
| 120 |
+
const saveBtn = document.getElementById('saveBtn');
|
| 121 |
+
const extractedText = document.getElementById('extractedText');
|
| 122 |
+
const overlay = document.getElementById('overlay');
|
| 123 |
+
const selectionBox = document.getElementById('selectionBox');
|
| 124 |
+
const outputFormat = document.getElementById('outputFormat');
|
| 125 |
+
const savePath = document.getElementById('savePath');
|
| 126 |
+
const changePathBtn = document.getElementById('changePathBtn');
|
| 127 |
+
|
| 128 |
+
let isSelecting = false;
|
| 129 |
+
let startX, startY, endX, endY;
|
| 130 |
+
|
| 131 |
+
// Set default save path (electron would handle this differently)
|
| 132 |
+
savePath.value = "Documents/ScreenSnips/";
|
| 133 |
+
|
| 134 |
+
startCaptureBtn.addEventListener('click', () => {
|
| 135 |
+
isSelecting = true;
|
| 136 |
+
overlay.style.display = 'block';
|
| 137 |
+
document.body.style.cursor = 'crosshair';
|
| 138 |
+
startCaptureBtn.disabled = true;
|
| 139 |
+
startCaptureBtn.classList.add('opacity-70');
|
| 140 |
+
});
|
| 141 |
+
|
| 142 |
+
overlay.addEventListener('mousedown', (e) => {
|
| 143 |
+
if (!isSelecting) return;
|
| 144 |
+
|
| 145 |
+
startX = e.clientX;
|
| 146 |
+
startY = e.clientY;
|
| 147 |
+
selectionBox.style.left = startX + 'px';
|
| 148 |
+
selectionBox.style.top = startY + 'px';
|
| 149 |
+
selectionBox.style.width = '0';
|
| 150 |
+
selectionBox.style.height = '0';
|
| 151 |
+
selectionBox.style.display = 'block';
|
| 152 |
+
});
|
| 153 |
+
|
| 154 |
+
overlay.addEventListener('mousemove', (e) => {
|
| 155 |
+
if (!isSelecting || !startX) return;
|
| 156 |
+
|
| 157 |
+
endX = e.clientX;
|
| 158 |
+
endY = e.clientY;
|
| 159 |
+
|
| 160 |
+
selectionBox.style.left = Math.min(startX, endX) + 'px';
|
| 161 |
+
selectionBox.style.top = Math.min(startY, endY) + 'px';
|
| 162 |
+
selectionBox.style.width = Math.abs(endX - startX) + 'px';
|
| 163 |
+
selectionBox.style.height = Math.abs(endY - startY) + 'px';
|
| 164 |
+
});
|
| 165 |
+
|
| 166 |
+
overlay.addEventListener('mouseup', async () => {
|
| 167 |
+
if (!isSelecting || !startX) return;
|
| 168 |
+
|
| 169 |
+
isSelecting = false;
|
| 170 |
+
document.body.style.cursor = '';
|
| 171 |
+
|
| 172 |
+
// Hide overlay and selection box
|
| 173 |
+
overlay.style.display = 'none';
|
| 174 |
+
selectionBox.style.display = 'none';
|
| 175 |
+
|
| 176 |
+
// Get the selected area coordinates
|
| 177 |
+
const left = Math.min(startX, endX);
|
| 178 |
+
const top = Math.min(startY, endY);
|
| 179 |
+
const width = Math.abs(endX - startX);
|
| 180 |
+
const height = Math.abs(endY - startY);
|
| 181 |
+
|
| 182 |
+
// In a real Electron app, we would use the desktopCapturer API here
|
| 183 |
+
// For this demo, we'll simulate with html2canvas
|
| 184 |
+
try {
|
| 185 |
+
// Show loading state
|
| 186 |
+
extractedText.textContent = "Processing...";
|
| 187 |
+
|
| 188 |
+
// In a real app, we would capture the screen here
|
| 189 |
+
// For demo purposes, we'll just simulate with some sample text
|
| 190 |
+
setTimeout(() => {
|
| 191 |
+
// Simulate OCR processing
|
| 192 |
+
const sampleText = `Sample extracted text from screen area:
|
| 193 |
+
|
| 194 |
+
Left: ${left}px
|
| 195 |
+
Top: ${top}px
|
| 196 |
+
Width: ${width}px
|
| 197 |
+
Height: ${height}px
|
| 198 |
+
|
| 199 |
+
This is where the actual OCR text would appear. In a real app, this would be the text extracted from the selected screen area using Tesseract.js or similar OCR technology.
|
| 200 |
+
|
| 201 |
+
The text would then be saved to a file in the selected format (${outputFormat.value}) at the specified location.`;
|
| 202 |
+
|
| 203 |
+
extractedText.textContent = sampleText;
|
| 204 |
+
saveBtn.disabled = false;
|
| 205 |
+
saveBtn.classList.remove('opacity-70');
|
| 206 |
+
startCaptureBtn.disabled = false;
|
| 207 |
+
startCaptureBtn.classList.remove('opacity-70');
|
| 208 |
+
}, 1500);
|
| 209 |
+
} catch (error) {
|
| 210 |
+
console.error('Capture error:', error);
|
| 211 |
+
extractedText.textContent = "Error capturing screen area. Please try again.";
|
| 212 |
+
startCaptureBtn.disabled = false;
|
| 213 |
+
startCaptureBtn.classList.remove('opacity-70');
|
| 214 |
+
}
|
| 215 |
+
});
|
| 216 |
+
|
| 217 |
+
saveBtn.addEventListener('click', () => {
|
| 218 |
+
if (!extractedText.textContent.trim()) return;
|
| 219 |
+
|
| 220 |
+
// In a real Electron app, we would use the fs module here
|
| 221 |
+
// For demo, we'll just show a success message
|
| 222 |
+
saveBtn.disabled = true;
|
| 223 |
+
saveBtn.classList.add('opacity-70');
|
| 224 |
+
|
| 225 |
+
const format = outputFormat.value;
|
| 226 |
+
const path = savePath.value;
|
| 227 |
+
|
| 228 |
+
extractedText.textContent += `\n\nFile saved to: ${path}capture_${Date.now()}.${format}`;
|
| 229 |
+
|
| 230 |
+
setTimeout(() => {
|
| 231 |
+
saveBtn.disabled = false;
|
| 232 |
+
saveBtn.classList.remove('opacity-70');
|
| 233 |
+
}, 2000);
|
| 234 |
+
});
|
| 235 |
+
|
| 236 |
+
changePathBtn.addEventListener('click', () => {
|
| 237 |
+
// In a real Electron app, we would use dialog.showOpenDialog here
|
| 238 |
+
// For demo, we'll just show a simulated path change
|
| 239 |
+
savePath.value = "Documents/ScreenSnips/NewFolder/";
|
| 240 |
+
});
|
| 241 |
+
});
|
| 242 |
+
</script>
|
| 243 |
+
</body>
|
| 244 |
</html>
|