missvector commited on
Commit
51c858c
·
1 Parent(s): 172af3d
Files changed (8) hide show
  1. Dockerfile +2 -8
  2. app.py +37 -32
  3. index.html +3 -3
  4. requirements.txt +0 -5
  5. script.js +160 -0
  6. static/script.js +15 -33
  7. static/styles.css +90 -229
  8. styles.css +320 -0
Dockerfile CHANGED
@@ -4,21 +4,15 @@ WORKDIR /app
4
 
5
  RUN apt-get update && apt-get install -y \
6
  ffmpeg \
7
- wget \
8
- unzip \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # Скачиваем Vosk модель при сборке
12
- RUN wget https://alphacephei.com/vosk/models/vosk-model-small-ru-0.22.zip \
13
- && unzip vosk-model-small-ru-0.22.zip \
14
- && rm vosk-model-small-ru-0.22.zip
15
-
16
  COPY requirements.txt .
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
  COPY app.py .
20
  COPY index.html .
21
- COPY static ./static
22
 
23
  ENV PORT=7860
24
  EXPOSE 7860
 
4
 
5
  RUN apt-get update && apt-get install -y \
6
  ffmpeg \
7
+ gcc \
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
 
 
 
 
 
10
  COPY requirements.txt .
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
  COPY app.py .
14
  COPY index.html .
15
+ COPY static ./static
16
 
17
  ENV PORT=7860
18
  EXPOSE 7860
app.py CHANGED
@@ -1,16 +1,16 @@
1
  import os
2
- import json
3
  import tempfile
4
  import shutil
5
- import replicate
6
  from pathlib import Path
7
  from fastapi import FastAPI, File, UploadFile
8
- from fastapi.responses import HTMLResponse, StreamingResponse
9
  from fastapi.staticfiles import StaticFiles
10
  from fastapi.middleware.cors import CORSMiddleware
 
11
 
12
  app = FastAPI()
13
 
 
14
  app.add_middleware(
15
  CORSMiddleware,
16
  allow_origins=["*"],
@@ -18,9 +18,16 @@ app.add_middleware(
18
  allow_headers=["*"],
19
  )
20
 
 
21
  app.mount("/static", StaticFiles(directory="static"), name="static")
22
 
23
- REPLICATE_TOKEN = os.getenv("REPLICATE_API_TOKEN")
 
 
 
 
 
 
24
 
25
  @app.get("/", response_class=HTMLResponse)
26
  async def root():
@@ -29,32 +36,30 @@ async def root():
29
 
30
  @app.post("/transcribe")
31
  async def transcribe_audio(file: UploadFile = File(...)):
32
- async def generate():
33
- try:
34
- yield json.dumps({"type": "status", "text": "🔄 Загрузка файла..."}) + "\n"
35
-
36
- suffix = Path(file.filename).suffix
37
- with tempfile.NamedTemporaryFile(delete=False, suffix=suffix) as tmp:
38
- shutil.copyfileobj(file.file, tmp)
39
- tmp_path = tmp.name
40
-
41
- yield json.dumps({"type": "status", "text": "🔄 Распознавание через Replicate..."}) + "\n"
42
-
43
- client = replicate.Client(api_token=REPLICATE_TOKEN)
44
-
45
- with open(tmp_path, "rb") as f:
46
- output = client.run(
47
- "openai/whisper:4d50797290df275329f202e48c76360b3f22b08d28c196cbc54600319435f8d2",
48
- input={"audio": f}
49
- )
50
-
51
- Path(tmp_path).unlink()
52
-
53
- yield json.dumps({"type": "done", "text": output["text"]}) + "\n"
54
-
55
- except Exception as e:
56
- yield json.dumps({"type": "error", "text": f"❌ Ошибка: {str(e)}"}) + "\n"
57
- finally:
58
- file.file.close()
59
 
60
- return StreamingResponse(generate(), media_type="application/x-ndjson")
 
 
 
 
 
 
 
 
 
 
 
1
  import os
 
2
  import tempfile
3
  import shutil
 
4
  from pathlib import Path
5
  from fastapi import FastAPI, File, UploadFile
6
+ from fastapi.responses import HTMLResponse, JSONResponse
7
  from fastapi.staticfiles import StaticFiles
8
  from fastapi.middleware.cors import CORSMiddleware
9
+ from faster_whisper import WhisperModel
10
 
11
  app = FastAPI()
12
 
13
+ # CORS
14
  app.add_middleware(
15
  CORSMiddleware,
16
  allow_origins=["*"],
 
18
  allow_headers=["*"],
19
  )
20
 
21
+ # Static files
22
  app.mount("/static", StaticFiles(directory="static"), name="static")
23
 
24
+ print("Loading faster-whisper-tiny...")
25
+ model = WhisperModel(
26
+ "tiny",
27
+ device="cpu",
28
+ compute_type="int8"
29
+ )
30
+ print("Model ready")
31
 
32
  @app.get("/", response_class=HTMLResponse)
33
  async def root():
 
36
 
37
  @app.post("/transcribe")
38
  async def transcribe_audio(file: UploadFile = File(...)):
39
+ tmp_path = None
40
+ try:
41
+ # Save uploaded file
42
+ suffix = Path(file.filename).suffix
43
+ with tempfile.NamedTemporaryFile(delete=False, suffix=suffix) as tmp:
44
+ shutil.copyfileobj(file.file, tmp)
45
+ tmp_path = tmp.name
46
+
47
+ # Transcribe with faster-whisper
48
+ segments, info = model.transcribe(tmp_path, language="ru", beam_size=5)
49
+
50
+ # Collect all text
51
+ text = " ".join([segment.text for segment in segments])
52
+
53
+ return JSONResponse({"text": text.strip(), "status": "ok"})
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ except Exception as e:
56
+ print(f"Error: {str(e)}")
57
+ return JSONResponse(
58
+ {"text": f"Error: {str(e)}", "status": "error"},
59
+ status_code=500
60
+ )
61
+ finally:
62
+ # Clean up
63
+ if tmp_path and Path(tmp_path).exists():
64
+ Path(tmp_path).unlink()
65
+ await file.close()
index.html CHANGED
@@ -14,9 +14,9 @@
14
  <div class="copy-wrapper">
15
  <span class="copy-feedback" id="copyFeedback">текст скопирован</span>
16
  <button class="copy-btn" id="copyBtn" title="Копировать">
17
- <svg viewBox="0 0 24 24">
18
- <rect x="9" y="9" width="13" height="13" rx="1.5" stroke-linecap="round"/>
19
- <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" stroke-linecap="round"/>
20
  </svg>
21
  </button>
22
  </div>
 
14
  <div class="copy-wrapper">
15
  <span class="copy-feedback" id="copyFeedback">текст скопирован</span>
16
  <button class="copy-btn" id="copyBtn" title="Копировать">
17
+ <svg viewBox="0 0 24 24" width="20" height="20">
18
+ <rect x="9" y="9" width="13" height="13" rx="1.5" stroke="currentColor" fill="none" stroke-width="1.5"/>
19
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" stroke="currentColor" fill="none" stroke-width="1.5"/>
20
  </svg>
21
  </button>
22
  </div>
requirements.txt CHANGED
@@ -1,9 +1,4 @@
1
  fastapi
2
  uvicorn[standard]
3
- openai-whisper
4
- torch
5
- torchaudio
6
  python-multipart
7
  faster-whisper
8
- vosk
9
- replicate
 
1
  fastapi
2
  uvicorn[standard]
 
 
 
3
  python-multipart
4
  faster-whisper
 
 
script.js ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ============================================
2
+ // AUDIO TO TEXT - ЧИСТЫЙ СТАТИК
3
+ // ============================================
4
+
5
+ const API_URL = 'https://api-inference.huggingface.co/models/openai/whisper-tiny';
6
+
7
+ // Элементы интерфейса
8
+ const copyBtn = document.getElementById('copyBtn');
9
+ const copyFeedback = document.getElementById('copyFeedback');
10
+ const transcriptText = document.getElementById('transcriptText');
11
+ const dropZone = document.getElementById('dropZone');
12
+ const attachBtn = document.getElementById('attachBtn');
13
+ const transcriptArea = document.getElementById('transcriptArea');
14
+
15
+ // ========== УПРАВЛЕНИЕ ТОКЕНОМ ==========
16
+ let HF_TOKEN = localStorage.getItem('hf_token');
17
+
18
+ function promptForToken() {
19
+ const token = prompt('🔑 Введи свой Hugging Face токен:\n(получить: https://huggingface.co/settings/tokens)');
20
+ if (token) {
21
+ localStorage.setItem('hf_token', token);
22
+ HF_TOKEN = token;
23
+ return true;
24
+ }
25
+ return false;
26
+ }
27
+
28
+ function resetToken() {
29
+ localStorage.removeItem('hf_token');
30
+ HF_TOKEN = null;
31
+ alert('🔄 Токен сброшен. Обнови страницу для ввода нового.');
32
+ }
33
+
34
+ // Проверяем токен при загрузке
35
+ if (!HF_TOKEN) {
36
+ promptForToken();
37
+ }
38
+
39
+ // ========== КОПИРОВАНИЕ ==========
40
+ copyBtn.addEventListener('click', async () => {
41
+ if (transcriptText.value) {
42
+ await navigator.clipboard.writeText(transcriptText.value);
43
+ copyFeedback.classList.add('show');
44
+ setTimeout(() => copyFeedback.classList.remove('show'), 2000);
45
+ }
46
+ });
47
+
48
+ // ========== DRAG & DROP ==========
49
+ ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
50
+ dropZone.addEventListener(eventName, preventDefaults, false);
51
+ });
52
+
53
+ function preventDefaults(e) {
54
+ e.preventDefault();
55
+ e.stopPropagation();
56
+ }
57
+
58
+ ['dragenter', 'dragover'].forEach(eventName => {
59
+ dropZone.addEventListener(eventName, () => {
60
+ dropZone.classList.add('drag-over');
61
+ });
62
+ });
63
+
64
+ ['dragleave', 'drop'].forEach(eventName => {
65
+ dropZone.addEventListener(eventName, () => {
66
+ dropZone.classList.remove('drag-over');
67
+ });
68
+ });
69
+
70
+ dropZone.addEventListener('drop', (e) => {
71
+ const files = e.dataTransfer.files;
72
+ if (files.length) {
73
+ handleFile(files[0]);
74
+ }
75
+ });
76
+
77
+ // ========== ВЫБОР ФАЙЛА ==========
78
+ attachBtn.addEventListener('click', () => {
79
+ const input = document.createElement('input');
80
+ input.type = 'file';
81
+ input.accept = 'audio/*';
82
+ input.onchange = (e) => {
83
+ if (e.target.files.length) {
84
+ handleFile(e.target.files[0]);
85
+ }
86
+ };
87
+ input.click();
88
+ });
89
+
90
+ dropZone.addEventListener('click', (e) => {
91
+ if (e.target !== attachBtn && !attachBtn.contains(e.target)) {
92
+ attachBtn.click();
93
+ }
94
+ });
95
+
96
+ // ========== ОСНОВНАЯ ФУНКЦИЯ ==========
97
+ async function handleFile(file) {
98
+ console.log('🎵 файл:', file.name);
99
+
100
+ // Проверяем токен
101
+ if (!HF_TOKEN) {
102
+ if (!promptForToken()) {
103
+ transcriptText.value = '❌ Без токена невозможно распознать речь';
104
+ return;
105
+ }
106
+ }
107
+
108
+ dropZone.style.display = 'none';
109
+ transcriptArea.classList.add('active');
110
+ transcriptText.value = '🔄 Отправка на распознавание...';
111
+
112
+ const formData = new FormData();
113
+ formData.append('file', file);
114
+
115
+ try {
116
+ const arrayBuffer = await file.arrayBuffer();
117
+
118
+ const response = await fetch(API_URL, {
119
+ method: 'POST',
120
+ headers: {
121
+ 'Authorization': `Bearer ${HF_TOKEN}`,
122
+ 'Content-Type': file.type || 'audio/mpeg'
123
+ },
124
+ body: arrayBuffer
125
+ });
126
+
127
+ // Обработка ошибок авторизации
128
+ if (response.status === 401 || response.status === 403) {
129
+ localStorage.removeItem('hf_token');
130
+ HF_TOKEN = null;
131
+ transcriptText.value = '❌ Токен недействителен. Обнови страницу и введи новый.';
132
+ return;
133
+ }
134
+
135
+ if (!response.ok) {
136
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
137
+ }
138
+
139
+ const data = await response.json();
140
+ transcriptText.value = data.text || '⚠️ Пустой ответ от API';
141
+
142
+ } catch (error) {
143
+ transcriptText.value = `❌ Ошибка: ${error.message}`;
144
+ console.error(error);
145
+ }
146
+ }
147
+
148
+ // ========== ДОБАВЛЯЕМ КНОПКУ СБРОСА В ФУТЕР ==========
149
+ // Этот код добавит ссылку для сброса токена в футер
150
+ document.addEventListener('DOMContentLoaded', () => {
151
+ const footer = document.querySelector('.footer');
152
+ if (footer) {
153
+ const resetLink = document.createElement('span');
154
+ resetLink.innerHTML = ' · <a href="#" onclick="resetToken(); return false;">🔄 сбросить токен</a>';
155
+ footer.appendChild(resetLink);
156
+ }
157
+ });
158
+
159
+ // Делаем функцию глобальной
160
+ window.resetToken = resetToken;
static/script.js CHANGED
@@ -5,6 +5,7 @@ const dropZone = document.getElementById('dropZone');
5
  const attachBtn = document.getElementById('attachBtn');
6
  const transcriptArea = document.getElementById('transcriptArea');
7
 
 
8
  copyBtn.addEventListener('click', async () => {
9
  if (transcriptText.value) {
10
  await navigator.clipboard.writeText(transcriptText.value);
@@ -15,6 +16,7 @@ copyBtn.addEventListener('click', async () => {
15
  }
16
  });
17
 
 
18
  ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
19
  dropZone.addEventListener(eventName, preventDefaults, false);
20
  });
@@ -24,6 +26,7 @@ function preventDefaults(e) {
24
  e.stopPropagation();
25
  }
26
 
 
27
  ['dragenter', 'dragover'].forEach(eventName => {
28
  dropZone.addEventListener(eventName, () => {
29
  dropZone.classList.add('drag-over');
@@ -36,6 +39,7 @@ function preventDefaults(e) {
36
  });
37
  });
38
 
 
39
  dropZone.addEventListener('drop', (e) => {
40
  const files = e.dataTransfer.files;
41
  if (files.length) {
@@ -43,6 +47,7 @@ dropZone.addEventListener('drop', (e) => {
43
  }
44
  });
45
 
 
46
  attachBtn.addEventListener('click', () => {
47
  const input = document.createElement('input');
48
  input.type = 'file';
@@ -55,18 +60,20 @@ attachBtn.addEventListener('click', () => {
55
  input.click();
56
  });
57
 
 
58
  dropZone.addEventListener('click', (e) => {
59
  if (e.target !== attachBtn && !attachBtn.contains(e.target)) {
60
  attachBtn.click();
61
  }
62
  });
63
 
 
64
  async function handleFile(file) {
65
  console.log('файл получен:', file.name);
66
 
67
  dropZone.style.display = 'none';
68
  transcriptArea.classList.add('active');
69
- transcriptText.value = '🔄 Подготовка...';
70
 
71
  const formData = new FormData();
72
  formData.append('file', file);
@@ -77,40 +84,15 @@ async function handleFile(file) {
77
  body: formData
78
  });
79
 
80
- const reader = response.body.getReader();
81
- const decoder = new TextDecoder();
82
- let buffer = '';
83
 
84
- while (true) {
85
- const { value, done } = await reader.read();
86
- if (done) break;
87
-
88
- buffer += decoder.decode(value, { stream: true });
89
- const lines = buffer.split('\n');
90
- buffer = lines.pop();
91
-
92
- for (const line of lines) {
93
- if (line.trim()) {
94
- try {
95
- const data = JSON.parse(line);
96
-
97
- if (data.type === 'status') {
98
- transcriptText.value = data.text;
99
- } else if (data.type === 'segment') {
100
- transcriptText.value = data.text;
101
- } else if (data.type === 'done') {
102
- transcriptText.value = data.text;
103
- } else if (data.type === 'error') {
104
- transcriptText.value = data.text;
105
- }
106
- } catch (e) {
107
- console.error('Error parsing JSON:', e);
108
- }
109
- }
110
- }
111
  }
112
  } catch (error) {
113
- transcriptText.value = 'Ошибка соединения';
114
- console.error(error);
115
  }
116
  }
 
5
  const attachBtn = document.getElementById('attachBtn');
6
  const transcriptArea = document.getElementById('transcriptArea');
7
 
8
+ // Copy button functionality
9
  copyBtn.addEventListener('click', async () => {
10
  if (transcriptText.value) {
11
  await navigator.clipboard.writeText(transcriptText.value);
 
16
  }
17
  });
18
 
19
+ // Prevent defaults for drag events
20
  ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
21
  dropZone.addEventListener(eventName, preventDefaults, false);
22
  });
 
26
  e.stopPropagation();
27
  }
28
 
29
+ // Drag over effects
30
  ['dragenter', 'dragover'].forEach(eventName => {
31
  dropZone.addEventListener(eventName, () => {
32
  dropZone.classList.add('drag-over');
 
39
  });
40
  });
41
 
42
+ // Handle dropped files
43
  dropZone.addEventListener('drop', (e) => {
44
  const files = e.dataTransfer.files;
45
  if (files.length) {
 
47
  }
48
  });
49
 
50
+ // Attach button click
51
  attachBtn.addEventListener('click', () => {
52
  const input = document.createElement('input');
53
  input.type = 'file';
 
60
  input.click();
61
  });
62
 
63
+ // Click on drop zone (except attach button)
64
  dropZone.addEventListener('click', (e) => {
65
  if (e.target !== attachBtn && !attachBtn.contains(e.target)) {
66
  attachBtn.click();
67
  }
68
  });
69
 
70
+ // Handle file upload and transcription
71
  async function handleFile(file) {
72
  console.log('файл получен:', file.name);
73
 
74
  dropZone.style.display = 'none';
75
  transcriptArea.classList.add('active');
76
+ transcriptText.value = 'расшифровка...\n\nэто занимает несколько секунд';
77
 
78
  const formData = new FormData();
79
  formData.append('file', file);
 
84
  body: formData
85
  });
86
 
87
+ const data = await response.json();
 
 
88
 
89
+ if (data.status === 'ok') {
90
+ transcriptText.value = data.text;
91
+ } else {
92
+ transcriptText.value = 'Ошибка: ' + data.text;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
94
  } catch (error) {
95
+ transcriptText.value = 'Ошибка соединения с сервером';
96
+ console.error('Fetch error:', error);
97
  }
98
  }
static/styles.css CHANGED
@@ -4,317 +4,178 @@
4
  box-sizing: border-box;
5
  }
6
 
7
- html, body {
8
- height: 100%;
9
- width: 100%;
10
- overflow: hidden;
11
- }
12
-
13
  body {
14
- font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
15
- font-weight: 400;
16
- background: linear-gradient(165deg, #9b8aed 0%, #5a4a9a 100%);
17
  display: flex;
18
  justify-content: center;
19
  align-items: center;
20
- padding: 24px;
21
- height: 100vh;
22
- width: 100vw;
23
- overflow: hidden;
24
  }
25
 
26
  .frame {
 
27
  width: 100%;
28
- max-width: 880px;
29
- margin: 0 auto;
30
- display: flex;
31
- flex-direction: column;
32
- height: 100%;
33
- max-height: 800px;
34
- align-items: center;
35
  }
36
 
37
  h1 {
38
- color: white;
39
- font-size: clamp(36px, 7vw, 48px);
40
- font-weight: 520;
41
- letter-spacing: -0.03em;
42
- margin: 0 0 24px 0;
43
- text-transform: uppercase;
44
- font-family: 'Inter', sans-serif;
45
- line-height: 1;
46
- flex-shrink: 0;
47
- text-align: center;
48
- width: 100%;
49
- opacity: 0.95;
50
- transition: opacity 0.3s, letter-spacing 0.3s;
51
  }
52
 
53
- h1:hover {
54
- opacity: 1;
55
- letter-spacing: -0.02em;
 
 
 
56
  }
57
 
58
- .transcript-card {
59
- background: rgba(245, 245, 250, 0.95);
60
- backdrop-filter: blur(10px);
61
- border-radius: 32px;
62
- padding: 32px 32px 24px;
63
  position: relative;
64
  display: flex;
65
- flex-direction: column;
66
- box-shadow: 0 25px 40px -16px rgba(0,0,0,0.4),
67
- 0 0 0 1px rgba(255,255,255,0.1) inset;
68
- flex: 1;
69
- min-height: 0;
70
- width: 100%;
71
- transition: box-shadow 0.3s;
72
  }
73
 
74
- .transcript-card:hover {
75
- box-shadow: 0 28px 48px -18px rgba(0,0,0,0.5),
76
- 0 0 0 1px rgba(255,255,255,0.15) inset;
 
 
 
 
 
 
 
 
77
  }
78
 
79
- .copy-wrapper {
80
- position: absolute;
81
- top: 20px;
82
- right: 24px;
83
- display: flex;
84
- align-items: center;
85
- gap: 12px;
86
- z-index: 10;
87
  }
88
 
89
  .copy-btn {
90
- background: rgba(255,255,255,0.9);
91
- border: none;
92
- width: 44px;
93
- height: 44px;
94
- padding: 11px;
95
  cursor: pointer;
96
- border-radius: 50%;
 
97
  display: flex;
98
  align-items: center;
99
  justify-content: center;
100
- transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1);
101
- color: #2d2d2d;
102
- box-shadow: 0 2px 8px rgba(0,0,0,0.04);
103
- backdrop-filter: blur(4px);
104
  }
105
 
106
  .copy-btn:hover {
107
- background: white;
108
- box-shadow: 0 8px 18px rgba(0,0,0,0.15);
109
- transform: scale(0.96);
110
- color: #5a4a9a;
111
- }
112
-
113
- .copy-btn:active {
114
- transform: scale(0.92);
115
- }
116
-
117
- .copy-btn svg {
118
- width: 22px;
119
- height: 22px;
120
- stroke: currentColor;
121
- stroke-width: 1.8;
122
- fill: none;
123
- transition: stroke 0.2s;
124
- }
125
-
126
- .copy-feedback {
127
- font-size: 14px;
128
- color: #1e5e2b;
129
- font-weight: 500;
130
- opacity: 0;
131
- transition: opacity 0.2s ease, transform 0.2s ease;
132
- background: rgba(255,255,255,0.95);
133
- padding: 6px 16px;
134
- border-radius: 100px;
135
- box-shadow: 0 4px 16px rgba(0,0,0,0.1);
136
- letter-spacing: -0.01em;
137
- backdrop-filter: blur(4px);
138
- pointer-events: none;
139
- transform: translateX(4px);
140
- }
141
-
142
- .copy-feedback.show {
143
- opacity: 1;
144
- transform: translateX(0);
145
  }
146
 
147
  .drop-zone {
148
- flex: 1;
149
- display: flex;
150
- flex-direction: column;
151
- justify-content: center;
152
- align-items: center;
153
- min-height: 0;
154
- margin-top: 20px;
155
- width: 100%;
156
  cursor: pointer;
157
- transition: background 0.25s ease, transform 0.2s ease;
158
- border-radius: 24px;
159
  position: relative;
160
  }
161
 
162
  .drop-zone.drag-over {
163
- background: rgba(155, 138, 237, 0.12);
164
- backdrop-filter: blur(4px);
165
- }
166
-
167
- .drop-zone:active {
168
- transform: scale(0.99);
169
  }
170
 
171
  .instruction {
172
- font-family: 'JetBrains Mono', 'SF Mono', 'Roboto Mono', monospace;
173
- font-size: clamp(20px, 5vw, 26px);
174
- font-weight: 450;
175
- color: #2a2a2a;
176
- line-height: 1.4;
177
- text-align: center;
178
- max-width: 90%;
179
- margin-bottom: 16px;
180
- transition: opacity 0.2s;
181
  }
182
 
183
  .instruction-small {
184
- font-family: 'Inter', sans-serif;
185
- font-size: 15px;
186
- color: #5a5a5a;
187
- margin-top: 8px;
188
- font-weight: 400;
189
- letter-spacing: 0.2px;
190
- opacity: 0.8;
191
- transition: opacity 0.2s;
192
- }
193
-
194
- .drop-zone:hover .instruction-small {
195
- opacity: 1;
196
  }
197
 
198
  .attach-btn {
199
- background: none;
 
200
  border: none;
201
- width: 70px;
202
- height: 70px;
203
- font-size: 44px;
204
  cursor: pointer;
205
- padding: 0;
206
- transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1), opacity 0.2s;
207
- line-height: 1;
208
- display: flex;
209
- align-items: center;
210
- justify-content: center;
211
- margin-top: 12px;
212
- color: #3a3a5a;
213
- opacity: 0.75;
214
- transform-origin: center;
215
  }
216
 
217
  .attach-btn:hover {
218
- transform: scale(1.15) rotate(5deg);
219
- opacity: 1;
220
- }
221
-
222
- .attach-btn:active {
223
- transform: scale(1.05) rotate(2deg);
224
  }
225
 
226
  .transcript-area {
227
  display: none;
228
- width: 100%;
229
- height: 100%;
230
- flex-direction: column;
231
- animation: fadeIn 0.4s ease;
232
  }
233
 
234
  .transcript-area.active {
235
- display: flex;
236
- }
237
-
238
- @keyframes fadeIn {
239
- 0% { opacity: 0; transform: translateY(6px); }
240
- 100% { opacity: 1; transform: translateY(0); }
241
  }
242
 
243
- textarea {
244
  width: 100%;
245
- background: transparent;
246
- border: none;
247
- font-family: 'JetBrains Mono', 'SF Mono', monospace;
 
248
  font-size: 15px;
249
- line-height: 1.75;
250
- color: #1a1a2c;
251
- resize: none;
252
- flex: 1;
253
- padding: 12px 4px;
254
- margin: 0;
255
- outline: none;
256
- font-weight: 420;
257
  }
258
 
259
- textarea::placeholder {
260
- color: #8a8aa8;
261
- font-style: italic;
262
- opacity: 0.7;
263
  }
264
 
265
  .footer {
266
- margin-top: 24px;
267
- color: rgba(255,255,255,0.85);
268
- font-size: 15px;
269
- font-weight: 400;
270
- letter-spacing: 0.5px;
271
  text-align: center;
272
- flex-shrink: 0;
273
- padding-bottom: 4px;
274
- width: 100%;
275
- transition: opacity 0.2s;
276
  }
277
 
278
  .footer a {
279
- color: white;
280
  text-decoration: none;
281
- font-weight: 550;
282
- border-bottom: 1.5px solid rgba(255,255,255,0.25);
283
- padding-bottom: 2px;
284
- transition: border-color 0.2s, opacity 0.2s;
285
  }
286
 
287
  .footer a:hover {
288
- border-bottom-color: white;
289
- opacity: 1;
290
  }
291
 
292
  @media (max-width: 600px) {
293
- body {
294
- padding: 16px;
295
  }
296
 
297
  h1 {
298
- margin-bottom: 18px;
299
- }
300
-
301
- .instruction {
302
- font-size: 20px;
303
- }
304
-
305
- .transcript-card {
306
- padding: 24px 20px 20px;
307
- }
308
-
309
- .attach-btn {
310
- width: 64px;
311
- height: 64px;
312
- font-size: 42px;
313
- }
314
-
315
- .copy-btn {
316
- width: 40px;
317
- height: 40px;
318
- padding: 10px;
319
  }
320
  }
 
4
  box-sizing: border-box;
5
  }
6
 
 
 
 
 
 
 
7
  body {
8
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
9
+ background: #f5f5f7;
 
10
  display: flex;
11
  justify-content: center;
12
  align-items: center;
13
+ min-height: 100vh;
14
+ padding: 20px;
 
 
15
  }
16
 
17
  .frame {
18
+ max-width: 800px;
19
  width: 100%;
20
+ background: white;
21
+ border-radius: 24px;
22
+ padding: 32px;
23
+ box-shadow: 0 10px 30px rgba(0,0,0,0.05);
 
 
 
24
  }
25
 
26
  h1 {
27
+ font-size: 28px;
28
+ font-weight: 600;
29
+ margin-bottom: 24px;
30
+ color: #1d1d1f;
31
+ letter-spacing: -0.5px;
 
 
 
 
 
 
 
 
32
  }
33
 
34
+ .transcript-card {
35
+ background: #ffffff;
36
+ border: 1px solid #e6e6e8;
37
+ border-radius: 16px;
38
+ padding: 20px;
39
+ margin-bottom: 24px;
40
  }
41
 
42
+ .copy-wrapper {
 
 
 
 
43
  position: relative;
44
  display: flex;
45
+ justify-content: flex-end;
46
+ margin-bottom: 12px;
 
 
 
 
 
47
  }
48
 
49
+ .copy-feedback {
50
+ position: absolute;
51
+ right: 40px;
52
+ top: 4px;
53
+ font-size: 12px;
54
+ color: #28a745;
55
+ opacity: 0;
56
+ transition: opacity 0.2s;
57
+ background: white;
58
+ padding: 4px 8px;
59
+ border-radius: 12px;
60
  }
61
 
62
+ .copy-feedback.show {
63
+ opacity: 1;
 
 
 
 
 
 
64
  }
65
 
66
  .copy-btn {
67
+ background: none;
68
+ border: 1px solid #d2d2d7;
69
+ border-radius: 8px;
70
+ padding: 8px;
 
71
  cursor: pointer;
72
+ color: #86868b;
73
+ transition: all 0.2s;
74
  display: flex;
75
  align-items: center;
76
  justify-content: center;
 
 
 
 
77
  }
78
 
79
  .copy-btn:hover {
80
+ background: #f5f5f7;
81
+ border-color: #0071e3;
82
+ color: #0071e3;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
 
85
  .drop-zone {
86
+ border: 2px dashed #c6c6c8;
87
+ border-radius: 12px;
88
+ padding: 32px 20px;
89
+ text-align: center;
90
+ transition: all 0.2s;
 
 
 
91
  cursor: pointer;
92
+ margin-bottom: 16px;
 
93
  position: relative;
94
  }
95
 
96
  .drop-zone.drag-over {
97
+ border-color: #0071e3;
98
+ background: rgba(0,113,227,0.05);
 
 
 
 
99
  }
100
 
101
  .instruction {
102
+ font-size: 16px;
103
+ color: #1d1d1f;
104
+ margin-bottom: 4px;
 
 
 
 
 
 
105
  }
106
 
107
  .instruction-small {
108
+ font-size: 14px;
109
+ color: #86868b;
110
+ margin-bottom: 16px;
 
 
 
 
 
 
 
 
 
111
  }
112
 
113
  .attach-btn {
114
+ background: #0071e3;
115
+ color: white;
116
  border: none;
117
+ border-radius: 40px;
118
+ padding: 12px 24px;
119
+ font-size: 16px;
120
  cursor: pointer;
121
+ transition: background 0.2s;
122
+ box-shadow: 0 2px 8px rgba(0,113,227,0.3);
 
 
 
 
 
 
 
 
123
  }
124
 
125
  .attach-btn:hover {
126
+ background: #0077ed;
 
 
 
 
 
127
  }
128
 
129
  .transcript-area {
130
  display: none;
 
 
 
 
131
  }
132
 
133
  .transcript-area.active {
134
+ display: block;
 
 
 
 
 
135
  }
136
 
137
+ #transcriptText {
138
  width: 100%;
139
+ min-height: 200px;
140
+ padding: 16px;
141
+ border: 1px solid #e6e6e8;
142
+ border-radius: 12px;
143
  font-size: 15px;
144
+ line-height: 1.6;
145
+ font-family: inherit;
146
+ resize: vertical;
147
+ background: #fafafc;
148
+ color: #1d1d1f;
 
 
 
149
  }
150
 
151
+ #transcriptText:focus {
152
+ outline: none;
153
+ border-color: #0071e3;
 
154
  }
155
 
156
  .footer {
 
 
 
 
 
157
  text-align: center;
158
+ color: #86868b;
159
+ font-size: 14px;
 
 
160
  }
161
 
162
  .footer a {
163
+ color: #515154;
164
  text-decoration: none;
165
+ font-weight: 500;
 
 
 
166
  }
167
 
168
  .footer a:hover {
169
+ color: #0071e3;
170
+ text-decoration: underline;
171
  }
172
 
173
  @media (max-width: 600px) {
174
+ .frame {
175
+ padding: 20px;
176
  }
177
 
178
  h1 {
179
+ font-size: 24px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  }
181
  }
styles.css ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ html, body {
8
+ height: 100%;
9
+ width: 100%;
10
+ overflow: hidden;
11
+ }
12
+
13
+ body {
14
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
15
+ font-weight: 400;
16
+ background: linear-gradient(165deg, #9b8aed 0%, #5a4a9a 100%);
17
+ display: flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+ padding: 24px;
21
+ height: 100vh;
22
+ width: 100vw;
23
+ overflow: hidden;
24
+ }
25
+
26
+ .frame {
27
+ width: 100%;
28
+ max-width: 880px;
29
+ margin: 0 auto;
30
+ display: flex;
31
+ flex-direction: column;
32
+ height: 100%;
33
+ max-height: 800px;
34
+ align-items: center;
35
+ }
36
+
37
+ h1 {
38
+ color: white;
39
+ font-size: clamp(36px, 7vw, 48px);
40
+ font-weight: 520;
41
+ letter-spacing: -0.03em;
42
+ margin: 0 0 24px 0;
43
+ text-transform: uppercase;
44
+ font-family: 'Inter', sans-serif;
45
+ line-height: 1;
46
+ flex-shrink: 0;
47
+ text-align: center;
48
+ width: 100%;
49
+ opacity: 0.95;
50
+ transition: opacity 0.3s, letter-spacing 0.3s;
51
+ }
52
+
53
+ h1:hover {
54
+ opacity: 1;
55
+ letter-spacing: -0.02em;
56
+ }
57
+
58
+ .transcript-card {
59
+ background: rgba(245, 245, 250, 0.95);
60
+ backdrop-filter: blur(10px);
61
+ border-radius: 32px;
62
+ padding: 32px 32px 24px;
63
+ position: relative;
64
+ display: flex;
65
+ flex-direction: column;
66
+ box-shadow: 0 25px 40px -16px rgba(0,0,0,0.4),
67
+ 0 0 0 1px rgba(255,255,255,0.1) inset;
68
+ flex: 1;
69
+ min-height: 0;
70
+ width: 100%;
71
+ transition: box-shadow 0.3s;
72
+ }
73
+
74
+ .transcript-card:hover {
75
+ box-shadow: 0 28px 48px -18px rgba(0,0,0,0.5),
76
+ 0 0 0 1px rgba(255,255,255,0.15) inset;
77
+ }
78
+
79
+ .copy-wrapper {
80
+ position: absolute;
81
+ top: 20px;
82
+ right: 24px;
83
+ display: flex;
84
+ align-items: center;
85
+ gap: 12px;
86
+ z-index: 10;
87
+ }
88
+
89
+ .copy-btn {
90
+ background: rgba(255,255,255,0.9);
91
+ border: none;
92
+ width: 44px;
93
+ height: 44px;
94
+ padding: 11px;
95
+ cursor: pointer;
96
+ border-radius: 50%;
97
+ display: flex;
98
+ align-items: center;
99
+ justify-content: center;
100
+ transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1);
101
+ color: #2d2d2d;
102
+ box-shadow: 0 2px 8px rgba(0,0,0,0.04);
103
+ backdrop-filter: blur(4px);
104
+ }
105
+
106
+ .copy-btn:hover {
107
+ background: white;
108
+ box-shadow: 0 8px 18px rgba(0,0,0,0.15);
109
+ transform: scale(0.96);
110
+ color: #5a4a9a;
111
+ }
112
+
113
+ .copy-btn:active {
114
+ transform: scale(0.92);
115
+ }
116
+
117
+ .copy-btn svg {
118
+ width: 22px;
119
+ height: 22px;
120
+ stroke: currentColor;
121
+ stroke-width: 1.8;
122
+ fill: none;
123
+ transition: stroke 0.2s;
124
+ }
125
+
126
+ .copy-feedback {
127
+ font-size: 14px;
128
+ color: #1e5e2b;
129
+ font-weight: 500;
130
+ opacity: 0;
131
+ transition: opacity 0.2s ease, transform 0.2s ease;
132
+ background: rgba(255,255,255,0.95);
133
+ padding: 6px 16px;
134
+ border-radius: 100px;
135
+ box-shadow: 0 4px 16px rgba(0,0,0,0.1);
136
+ letter-spacing: -0.01em;
137
+ backdrop-filter: blur(4px);
138
+ pointer-events: none;
139
+ transform: translateX(4px);
140
+ }
141
+
142
+ .copy-feedback.show {
143
+ opacity: 1;
144
+ transform: translateX(0);
145
+ }
146
+
147
+ .drop-zone {
148
+ flex: 1;
149
+ display: flex;
150
+ flex-direction: column;
151
+ justify-content: center;
152
+ align-items: center;
153
+ min-height: 0;
154
+ margin-top: 20px;
155
+ width: 100%;
156
+ cursor: pointer;
157
+ transition: background 0.25s ease, transform 0.2s ease;
158
+ border-radius: 24px;
159
+ position: relative;
160
+ }
161
+
162
+ .drop-zone.drag-over {
163
+ background: rgba(155, 138, 237, 0.12);
164
+ backdrop-filter: blur(4px);
165
+ }
166
+
167
+ .drop-zone:active {
168
+ transform: scale(0.99);
169
+ }
170
+
171
+ .instruction {
172
+ font-family: 'JetBrains Mono', 'SF Mono', 'Roboto Mono', monospace;
173
+ font-size: clamp(20px, 5vw, 26px);
174
+ font-weight: 450;
175
+ color: #2a2a2a;
176
+ line-height: 1.4;
177
+ text-align: center;
178
+ max-width: 90%;
179
+ margin-bottom: 16px;
180
+ transition: opacity 0.2s;
181
+ }
182
+
183
+ .instruction-small {
184
+ font-family: 'Inter', sans-serif;
185
+ font-size: 15px;
186
+ color: #5a5a5a;
187
+ margin-top: 8px;
188
+ font-weight: 400;
189
+ letter-spacing: 0.2px;
190
+ opacity: 0.8;
191
+ transition: opacity 0.2s;
192
+ }
193
+
194
+ .drop-zone:hover .instruction-small {
195
+ opacity: 1;
196
+ }
197
+
198
+ .attach-btn {
199
+ background: none;
200
+ border: none;
201
+ width: 70px;
202
+ height: 70px;
203
+ font-size: 44px;
204
+ cursor: pointer;
205
+ padding: 0;
206
+ transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1), opacity 0.2s;
207
+ line-height: 1;
208
+ display: flex;
209
+ align-items: center;
210
+ justify-content: center;
211
+ margin-top: 12px;
212
+ color: #3a3a5a;
213
+ opacity: 0.75;
214
+ transform-origin: center;
215
+ }
216
+
217
+ .attach-btn:hover {
218
+ transform: scale(1.15) rotate(5deg);
219
+ opacity: 1;
220
+ }
221
+
222
+ .attach-btn:active {
223
+ transform: scale(1.05) rotate(2deg);
224
+ }
225
+
226
+ .transcript-area {
227
+ display: none;
228
+ width: 100%;
229
+ height: 100%;
230
+ flex-direction: column;
231
+ animation: fadeIn 0.4s ease;
232
+ }
233
+
234
+ .transcript-area.active {
235
+ display: flex;
236
+ }
237
+
238
+ @keyframes fadeIn {
239
+ 0% { opacity: 0; transform: translateY(6px); }
240
+ 100% { opacity: 1; transform: translateY(0); }
241
+ }
242
+
243
+ textarea {
244
+ width: 100%;
245
+ background: transparent;
246
+ border: none;
247
+ font-family: 'JetBrains Mono', 'SF Mono', monospace;
248
+ font-size: 15px;
249
+ line-height: 1.75;
250
+ color: #1a1a2c;
251
+ resize: none;
252
+ flex: 1;
253
+ padding: 12px 4px;
254
+ margin: 0;
255
+ outline: none;
256
+ font-weight: 420;
257
+ }
258
+
259
+ textarea::placeholder {
260
+ color: #8a8aa8;
261
+ font-style: italic;
262
+ opacity: 0.7;
263
+ }
264
+
265
+ .footer {
266
+ margin-top: 24px;
267
+ color: rgba(255,255,255,0.85);
268
+ font-size: 15px;
269
+ font-weight: 400;
270
+ letter-spacing: 0.5px;
271
+ text-align: center;
272
+ flex-shrink: 0;
273
+ padding-bottom: 4px;
274
+ width: 100%;
275
+ transition: opacity 0.2s;
276
+ }
277
+
278
+ .footer a {
279
+ color: white;
280
+ text-decoration: none;
281
+ font-weight: 550;
282
+ border-bottom: 1.5px solid rgba(255,255,255,0.25);
283
+ padding-bottom: 2px;
284
+ transition: border-color 0.2s, opacity 0.2s;
285
+ }
286
+
287
+ .footer a:hover {
288
+ border-bottom-color: white;
289
+ opacity: 1;
290
+ }
291
+
292
+ @media (max-width: 600px) {
293
+ body {
294
+ padding: 16px;
295
+ }
296
+
297
+ h1 {
298
+ margin-bottom: 18px;
299
+ }
300
+
301
+ .instruction {
302
+ font-size: 20px;
303
+ }
304
+
305
+ .transcript-card {
306
+ padding: 24px 20px 20px;
307
+ }
308
+
309
+ .attach-btn {
310
+ width: 64px;
311
+ height: 64px;
312
+ font-size: 42px;
313
+ }
314
+
315
+ .copy-btn {
316
+ width: 40px;
317
+ height: 40px;
318
+ padding: 10px;
319
+ }
320
+ }