dhevadharshiniv commited on
Commit
5dd57bf
·
verified ·
1 Parent(s): 03bc5a3

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -6
main.py CHANGED
@@ -54,7 +54,7 @@ INDEX_HTML = """<!doctype html>
54
  body{font-family:Arial,Helvetica,sans-serif;display:flex;flex-direction:column;align-items:center;padding:16px}
55
  h1{margin:8px}
56
  video,canvas{width:100%;max-width:480px;border:2px solid #ccc;border-radius:10px;margin:8px 0}
57
- #output{white-space:pre-wrap;background:#f8f8f8;padding:10px;border-radius:10px;width:100%;max-width:480px;min-height:72px}
58
  .btn{padding:12px 18px;margin:8px;border:none;border-radius:10px;background:#0066cc;color:white;font-size:16px;cursor:pointer}
59
  .sr-live{position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden}
60
  </style>
@@ -80,7 +80,6 @@ const statusEl = document.getElementById('status');
80
  const output = document.getElementById('output');
81
  const audioPlayer = document.getElementById('tts-audio');
82
  const live = document.getElementById('live');
83
- let greeted = false; // speak once on first tap (mobile-safe)
84
 
85
  function say(text){
86
  try {
@@ -102,7 +101,7 @@ navigator.mediaDevices.getUserMedia({
102
  .then(stream => {
103
  camera.srcObject = stream;
104
  announce("Camera ready. Press Capture and Read.");
105
- // (mobile-safe) don't auto-speak here; we'll speak on first tap
106
  })
107
  .catch(err => {
108
  const m = "Camera error: " + err.message;
@@ -111,9 +110,6 @@ navigator.mediaDevices.getUserMedia({
111
  });
112
 
113
  async function captureAndSend(){
114
- // speak greeting on first user interaction (works on mobile)
115
- if (!greeted) { say("Camera ready. Press Capture to read."); greeted = true; }
116
-
117
  try {
118
  vibrate(); announce("Capturing image...");
119
  const canvas = document.createElement('canvas');
@@ -279,3 +275,5 @@ if __name__ == "__main__":
279
  proxy_headers=True,
280
  forwarded_allow_ips="*",
281
  )
 
 
 
54
  body{font-family:Arial,Helvetica,sans-serif;display:flex;flex-direction:column;align-items:center;padding:16px}
55
  h1{margin:8px}
56
  video,canvas{width:100%;max-width:480px;border:2px solid #ccc;border-radius:10px;margin:8px 0}
57
+ #output{white-space:pre-wrap;background:#f8f8f8;padding:10px;border-radius:8px;width:100%;max-width:480px;min-height:72px}
58
  .btn{padding:12px 18px;margin:8px;border:none;border-radius:10px;background:#0066cc;color:white;font-size:16px;cursor:pointer}
59
  .sr-live{position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden}
60
  </style>
 
80
  const output = document.getElementById('output');
81
  const audioPlayer = document.getElementById('tts-audio');
82
  const live = document.getElementById('live');
 
83
 
84
  function say(text){
85
  try {
 
101
  .then(stream => {
102
  camera.srcObject = stream;
103
  announce("Camera ready. Press Capture and Read.");
104
+ say("Camera ready. Press Capture to read."); // <--- voice message in present tense
105
  })
106
  .catch(err => {
107
  const m = "Camera error: " + err.message;
 
110
  });
111
 
112
  async function captureAndSend(){
 
 
 
113
  try {
114
  vibrate(); announce("Capturing image...");
115
  const canvas = document.createElement('canvas');
 
275
  proxy_headers=True,
276
  forwarded_allow_ips="*",
277
  )
278
+
279
+