• ื”ืจืฉืžื”
    • ื”ืชื—ื‘ืจื•ืช
    • ื—ื™ืคื•ืฉ
    • ื“ืฃ ื”ื‘ื™ืช
    • ืื™ื ื“ืงืก ืงื™ืฉื•ืจื™ื
    • ืคื•ืกื˜ื™ื ืื—ืจื•ื ื™ื
    • ืงื‘ืœืช ื”ืชืจืื•ืช ืžื”ื“ืคื“ืคืŸ
    • ืžืฉืชืžืฉื™ื
    • ื—ื™ืคื•ืฉ ื‘ื”ื’ื“ืจื•ืช ื”ืžืชืงื“ืžื•ืช
    • ื—ื™ืคื•ืฉ ื’ื•ื’ืœ ื‘ืคื•ืจื•ื
    • ื ื™ื”ื•ืœ ื”ืžืขืจื›ืช
    • ื ื™ื”ื•ืœ ื”ืžืขืจื›ืช - ืฉืจืช private

    ๐ŸŽ™๏ธ๐ŸŽฏ ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ ื‘ืขื‘ืจื™ืช โ€“ ื—ื™ื ื, ืื™ื›ื•ืชื™, ืžื“ื•ื™ืง!!

    ืขื–ืจื” ื”ื“ื“ื™ืช ืœืžืฉืชืžืฉื™ื ืžืชืงื“ืžื™ื
    9
    40
    784
    ื˜ื•ืขืŸ ืคื•ืกื˜ื™ื ื ื•ืกืคื™ื
    • ืžื”ื™ืฉืŸ ืœื—ื“ืฉ
    • ืžื”ื—ื“ืฉ ืœื™ืฉืŸ
    • ื”ื›ื™ ื”ืจื‘ื” ื”ืฆื‘ืขื•ืช
    ืชื’ื•ื‘ื”
    • ื”ื’ื™ื‘ื• ื›ื ื•ืฉื
    ื”ืชื—ื‘ืจื• ื‘ื›ื“ื™ ืœืคืจืกื ืชื’ื•ื‘ื”
    ื ื•ืฉื ื–ื” ื ืžื—ืง. ืจืง ืžืฉืชืžืฉื™ื ืขื ื”ืจืฉืื•ืช ืžืชืื™ืžื•ืช ื™ื•ื›ืœื• ืœืฆืคื•ืช ื‘ื•.
    • Y
      y6714453 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™ y6714453

      ื›ืžื” ืžื—ืฉื‘ื•ืช ืขืœ ืžื•ื“ืœ ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ...

      ื”ืจื‘ื” ืคืขืžื™ื ื‘ื›ืœ ืžื™ื ื™ ืžืขืจื›ื•ืช - ืจื•ืฆื™ื ืœืฉืœื‘ ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ, ื“ื”ื™ื™ื ื• ืฉืžืฉืชืžืฉ ื™ื•ื›ืœ ืœืฉืœื•ื— ื”ืงืœื˜ื” ืœืฉืจืช ื•ื”ืฉืจืช ื™ืชืžืœืœ ืืช ื”ื”ืงืœื˜ื”.
      ื™ืžื•ืช ื”ืžืฉื™ื— ืžืฆื™ืขื™ื ืžื•ื“ืœ ื›ื–ื”, ื•ื”ืืžืช ืฉืืฃ ืคืขื ืœื ื ื™ืกื™ืชื™ ืื•ืชื•, ื›ืš ืฉืื ื™ ืœื ื™ื•ื“ืข ืžื” ืจืžืช ื”ืื™ื›ื•ืช ืฉืœื•...
      ืื‘ืœ ื–ื” ื‘ืขืœื•ืช ื™ื—ื™ื“ื•ืช, ื•ืœื”ืจื‘ื” ืžืฉืชืžืฉื™ื ื–ื” ืžืกืคื™ืง ืกื™ื‘ื” ื›ื“ื™ ืœื ืกื•ืช ืœืžืฆื•ื ืืœื˜ืจื ื˜ื™ื‘ื”,
      (ื•ืžืžื™ืœื ื”ื˜ืงืกื˜ ื ืฉืœื— ืœืฉืจืช - ืื– ืœืžื” ืฉื”ืฉืจืช ืœื ื™ื‘ืฆืข ื’ื ืืช ื”ืชืžืœื•ืœ ื‘ืขืฆืžื•?!)

      ื™ืฉ ืฉืชื™ ืกืคืจื™ื•ืช ืžื•ื›ืจื•ืช ื•ื˜ื•ื‘ื•ืช ืœืชืžืœื•ืœ ืฉืžืชืื™ื ืœืขื‘ืจื™ืช,

      ืื—ื“ ืฉืœ ื’ื•ื’ืœ - ื”ืกืคืจื™ื™ื” SpeechRecognition
      ื•ืื—ื“ ืฉืœ ืžื™ื™ืงืจื•ืกื•ืคื˜ - ื”ืกืคืจื™ื™ื” Whisper

      ืœ Whisper ื™ืฉ ื™ื™ืชืจื•ืŸ ืžืฉืžืขื•ืชื™ - ืฉืืคืฉืจ ืœื”ื•ืจื™ื“ ืœืžื—ืฉื‘ ืœืœื ืฆื•ืจืš ื‘ื—ื™ื‘ื•ืจ ืœืื™ื ื˜ืจื ื˜, ืื‘ืœ ื‘ื’ืœืœ ืฉืžืžื™ืœื ืจื•ื‘ ื”ืฉื™ืžื•ืฉ ืžืžื™ืœื ื ืขืฉื” ื‘ื“ืจืš ื›ืœืœ ื‘ืฉืจืช ื•ื›ื“ื•' ืื– ื”ื™ื™ืชืจื•ืŸ ืœื ื›ืœ ื›ืš ืžืฉืžืขื•ืชื™...

      ืืžื ื ืœืื—ืจ ื‘ื“ื™ืงื•ืช ื•ืชืขื™ื•ืช... ื”ื’ืขืชื™ ืœืžืกืงื ื” ืฉื”ืžื•ื“ืœ ืฉืœ ื’ื•ื’ืœ, ืœื ืจื•ืื” ืืช ื”ื”ื•ื ืฉืœ ืžื™ื™ืงืจื•ืกื•ืคื˜...

      ื—ืฉื•ื‘ ืœื–ื›ื•ืจ ืฉื”ื”ืงืœื˜ื” ื‘ืกื•ืฃ ืžื’ื™ืขื” ื‘ืื™ื›ื•ืช ืฉืœ ื˜ืœืคื•ืŸ... ื•ืœื ืฉืœ ืงื•ื ื“ื ืกืจ ืื•ืœืคื ื™... ื•ืœื›ืŸ ื—ืฉื•ื‘ ืฉื”ืžื•ื“ืœ ื™ื™ื“ืข ืœื–ื”ื•ืช ืืช ื”ื“ื™ื‘ื•ืจ ื’ื ื‘ืชื ืื™ื ืงืฉื™ื ื›ืžื• ืจืขืฉื™ ืจืงืข, ืื™ื›ื•ืช ื™ืจื•ื“ื”, ื•ื›ื•'...

      ืื ื™ ื—ื•ืฉื‘ ืฉื”ืžื•ื“ืœ ืฉืœ ื’ื•ื’ืœ ื”ื•ื ืžื“ื•ื™ื™ืง ื•ืื™ื›ื•ืชื™ ื›ืžืขื˜ ืœืœื ื˜ืขื•ื™ื•ืช... ื•ื”ื™ื™ืชื™ ืžืžืœื™ืฅ ืœื›ืœ ืžื™ ืฉืจื•ืฆื” ืžืขืจื›ืช ืื™ื›ื•ืชื™ืช, ืœื”ืฉืชืžืฉ ื‘ื•...

      ืœื ืฆืจื™ืš ืžืคืชื— API !

      ืื ื™ ืจื•ืฆื” ืœื”ื•ืกื™ืฃ ื”ืžืœืฆื” ืžื ืกื™ื•ืŸ ื”ืจื‘ื” ื–ืžืŸ ื”ืฉืชืžืฉืชื™ ืขื ื–ื” ื•ืžืฉื•ื ืžื” ื”ื”ืชื—ืœื” ื•ื”ืกื•ืฃ ืฉืœ ื”ื”ืงืœื˜ื” ืœื ื–ื•ื”ื”... ืœืžืฉืœ ื‘ืžืงื•ื "ืื—ื“ ืฉืชื™ื™ื ืฉืœื•ืฉ ืืจื‘ืข" ื”ื•ื ื–ื™ื”ื” "ื“ ืฉืชื™ื™ื ืฉืœื•ืฉ ืืจ"- ืขื“ ืฉื”ื‘ื ืชื™ ืฉื”ืžื•ื“ืœ ืืžื ื ื”ื•ื ื˜ื•ื‘ ืื‘ืœ ืœืคืขืžื™ื ื”ืชื—ืœืช ื”ื”ืงืœื˜ื” ื•ืกื•ืฃ ื”ื”ืงืœื˜ื” ื ื—ืชืš (ืžืžืฉ ื‘ืžื™ืžื“ื™ื ืฉืœ ืฉื ื™ื™ื”) ื•ืœื›ืŸ ืื ืจื•ืฆื™ื ืœืฉืœื•ื— ื”ืงืœื˜ื” ืืจื•ื›ื” ืœืฉืจืช, ืœืžืฉืœ ืžืฉืคื˜ ืฉืœื ื•ื›ื•' ืื– ื–ื” ื‘ื“ืจืš ื›ืœืœ ืœื ื›ืœ ื›ืš ื‘ืขื™ื”...
      ืื‘ืœ ืื ืจื•ืฆื™ื ืœืฉืœื•ื— ืžื™ืœื” ืื—ืช ื•ื›ื“ื•' ืื– ื–ื” ื™ื›ื•ืœ ืœื”ื™ื•ืช ืžืื•ื“ ืžืฉืžืขื•ืชื™.... ืœื›ืŸ ืžื•ืžืœืฅ (ืžื ืกื™ื•ืŸ! ื–ื” ืคื•ืชืจ ืืช ื”ื‘ืขื™ื™ื”!) ืœื”ื•ืกื™ืฃ ืฉื ื™ื™ื” ืฉืงื˜ ื‘ืชื—ื™ืœืช ื•ืกื•ืฃ ื”ื”ืงืœื˜ื” ื›ืœื•ืžืจ ืื—ืจื™ ืฉื”ื™ื ื ืฉืœื—ืช ืœืฉืจืช, ืœืคื ื™ ืฉื’ื•ื’ืœ ืžืขื‘ื“ ืืช ื”ื”ืงืœื˜ื” ื•ืžื—ืœืฅ ืืช ื”ืชืžืœื•ืœ... - ืœื”ืฉืชืžืฉ ืขื ื”ืกืคืจื™ื™ื” pydub ื›ื“ื™ ืœื”ื•ืกื™ืฃ ืฉื ื™ื™ื” ืฉืงื˜ ืชื—ื™ืœื” ื•ืกื•ืฃ...
      (ืฆืจื™ืš ืœื‘ื“ื•ืง ืฉ-FFmpeg ืžื•ืชืงืŸ ื‘ืกื‘ื™ื‘ื”, ืื—ืจืช ื”ืกืคืจื™ื™ื” ืœื ืชืขื‘ื•ื“)

      ืขื•ื“ ืžืฉื”ื•...
      ืœืคืขืžื™ื ืื ื—ื ื• ื™ื•ื“ืขื™ื ืžืจืืฉ ืžื” ื”ืืคืฉืจื•ื™ื•ืช ืฉื”ืžืฉืชืžืฉ ื™ื›ื•ืœ ืœื•ืžืจ โ€“
      ืœืžืฉืœ ืฉืžื•ืช ืฉืœ ืขืจื™ื:

      ื‘ื ื™ ื‘ืจืง, ื™ืจื•ืฉืœื™ื, ืชืœ ืื‘ื™ื‘, ื—ื™ืคื”, ืืฉื“ื•ื“, ื•ื›ื•'...

      ืืคืฉืจ ืœืขืฉื•ืช ืฉื”ืงื•ื“ ื™ื–ื”ื” ืืช ื”ื“ื™ื‘ื•ืจ ื•ื™ื‘ืฆืข ื”ืชืืžื”
      ืœืžืฉืœ ืื ื”ืžื•ื“ืœ ื–ื™ื”ื” "ื™ืจื•ืฉืžื™ื" ืื– ื”ื•ื ื™ืชืื™ื ืœื™ืจื•ืฉืœื™ื...

      ืื ื™ ืžืฆืจืฃ ืคื” ืงื•ื“ ืคื™ื™ืชื•ืŸ ืœื“ื•ื’ืžื: โฌ‡


      ืื•ืœื™ ืฆืจื™ืš ืขื•ื“ ื›ืžื” ืฉื™ื ื•ื™ื™ื ื›ื“ื™ ืฉื™ืชืื™ื ืœื™ืžื•ืช ื”ืžืฉื™ื—...

      import os
      import tempfile
      import logging
      import requests
      from flask import Flask, request, jsonify
      from pydub import AudioSegment
      import speech_recognition as sr
      from rapidfuzz import process, fuzz
      
      # ------------------ Logging Configuration ------------------
      logging.basicConfig(
          level=logging.INFO,
          format="%(asctime)s | %(levelname)s | %(message)s",
          datefmt="%H:%M:%S"
      )
      
      app = Flask(__name__)
      
      # List of possible keywords to match
      KEYWORDS = ["ื‘ื ื™ ื‘ืจืง", "ื™ืจื•ืฉืœื™ื", "ืชืœ ืื‘ื™ื‘", "ื—ื™ืคื”", "ืืฉื“ื•ื“"]
      
      # ------------------ Helper Functions ------------------
      
      def add_silence(input_path: str) -> AudioSegment:
          """
          Add one second of silence at the beginning and end of the audio file.
          This improves speech recognition accuracy, especially for short recordings.
          """
          logging.info("Adding one second of silence to audio file...")
          audio = AudioSegment.from_file(input_path, format="wav")
          silence = AudioSegment.silent(duration=1000)  # 1000ms = 1 second
          return silence + audio + silence
      
      def recognize_speech(audio_segment: AudioSegment) -> str:
          """
          Perform speech recognition using Google SpeechRecognition API.
          """
          recognizer = sr.Recognizer()
          try:
              # Use a temporary file for SpeechRecognition to read
              with tempfile.NamedTemporaryFile(suffix=".wav", delete=True) as temp_wav:
                  audio_segment.export(temp_wav.name, format="wav")
                  with sr.AudioFile(temp_wav.name) as source:
                      data = recognizer.record(source)
      
                  text = recognizer.recognize_google(data, language="he-IL")
                  logging.info(f"Recognized text: {text}")
                  return text
          except sr.UnknownValueError:
              logging.warning("Speech not detected or unclear.")
              return ""
          except Exception as e:
              logging.error(f"Error during speech recognition: {e}")
              return ""
      
      def find_best_match(text: str) -> str | None:
          """
          Find the closest matching word from the predefined KEYWORDS list.
          """
          if not text:
              return None
      
          result = process.extractOne(text, KEYWORDS, scorer=fuzz.ratio)
          if result and result[1] >= 80:
              logging.info(f"Best match found: {result[0]} (confidence: {result[1]}%)")
              return result[0]
      
          logging.info("No sufficient match found.")
          return None
      
      # ------------------ API Endpoint ------------------
      
      @app.route("/upload_audio", methods=["GET"])
      def upload_audio():
          """
          Endpoint to receive an audio file via GET parameter,
          download it, process it, and return the recognized text with the best match.
          Example usage:
          /upload_audio?file_url=https://example.com/audio.wav
          """
          file_url = request.args.get("file_url")
          if not file_url:
              logging.error("Missing 'file_url' parameter.")
              return jsonify({"error": "Missing 'file_url' parameter"}), 400
      
          logging.info(f"Received file URL: {file_url}")
      
          try:
              # Step 1: Download the audio file
              response = requests.get(file_url, timeout=15)
              if response.status_code != 200:
                  logging.error(f"Failed to download audio file. Status code: {response.status_code}")
                  return jsonify({"error": "Failed to download audio file"}), 400
      
              with tempfile.NamedTemporaryFile(suffix=".wav", delete=True) as temp_input:
                  temp_input.write(response.content)
                  temp_input.flush()
                  logging.info(f"Audio downloaded and saved temporarily: {temp_input.name}")
      
                  # Step 2: Add silence
                  processed_audio = add_silence(temp_input.name)
      
                  # Step 3: Speech recognition
                  recognized_text = recognize_speech(processed_audio)
      
                  # Step 4: Matching against predefined keywords
                  matched_word = find_best_match(recognized_text)
      
                  if matched_word:
                      logging.info(f"Final matched keyword: {matched_word}")
                  else:
                      logging.info("No keyword match found.")
      
          except Exception as e:
              logging.error(f"Processing error: {e}")
              return jsonify({"error": "Error processing the audio file"}), 500
      
          return jsonify({
              "recognized_text": recognized_text,
              "matched_word": matched_word if matched_word else "No match found"
          })
      
      # ------------------ Run Server ------------------
      
      if __name__ == "__main__":
          port = int(os.environ.get("PORT", 5000))
          logging.info(f"Server running on port {port}")
          app.run(host="0.0.0.0", port=port)
      

      ืžืงื•ื•ื” ืฉื”ื™ื™ืชื™ ื‘ืจื•ืจ...
      ื‘ื›ืœ ืžืงืจื” ื’ื ืžื™ ืฉืœื ื”ื‘ื™ืŸ ืฉืœืคื—ื•ืช ื™ื™ื“ืข ืฉื™ืฉ ืื•ืคืฆื™ื” ื›ื–ื•, ื›ื“ืื™ ืœื ืกื•ืช! ๐Ÿ˜›
      ื‘ื”ืฆืœื—ื”!

      M ืœ ื™ 3 ืชื’ื•ื‘ื•ืช ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 13
      • M
        MGM IVR @y6714453 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

        @y6714453 ื›ืชื‘ ื‘๐ŸŽ™๏ธ๐ŸŽฏ ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ ื‘ืขื‘ืจื™ืช โ€“ ื—ื™ื ื, ืื™ื›ื•ืชื™, ืžื“ื•ื™ืง!!:

        ืœื ืฆืจื™ืš ืžืคืชื— API !

        ื™ื•ืชืจ ื ื›ื•ืŸ, ืฆืจื™ืš ืžืคืชื—, ืื‘ืœ ื™ืฉ ืžืคืชื— ืฉืžืกืชื•ื‘ื‘ ื‘ืขื•ืœื (ื”ื™ื” ื‘ืžืงื•ืจ ืœื“ืขืชื™ ื‘ื’ื•ื’ืœ ื›ืจื•ื, ื™ืฉ ืื—ื“ ื“ื•ืžื” ืœืคื™ื™ืจืคื•ืงืก), ื•ื”ื•ื ืžื•ื˜ืžืข ื‘ืกืคืจื™ื”

        Y ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
        • Y
          y6714453 @MGM IVR ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™ y6714453

          @MGM-IVR ื•ื‘ื›ืœ ื–ืืช ื”ื›ื•ื•ื ื” ื”ื™ื™ืชื” ืฉืœื ืฆืจื™ืš ืœื”ื›ื ื™ืก ื™ื“ื ื™ืช

          ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 2
          • ืœ
            ืœืขื–ื•ืจ ืœื›ื•ืœื @y6714453 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

            @y6714453
            ืื™ืš ืžืงื‘ืœื™ื ืืช ื”ื”ืงืœื˜ื” ื‘ืงืœื•ืช ืœืฉืจืช?

            C ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
            • C
              CUBASE @ืœืขื–ื•ืจ ืœื›ื•ืœื ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

              @ืœืขื–ื•ืจ-ืœื›ื•ืœื ื”ื•ืจื“ืช ืงื•ื‘ืฅ..

              ืœ ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
              • ืœ
                ืœืขื–ื•ืจ ืœื›ื•ืœื @CUBASE ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                @CUBASE
                ืื– ื–ื” ืชื”ืœื™ืš ืงืฆืช
                ืœืงื‘ืœ ืžื™ืžื•ืช ื”ืžืฉื™ื— ืืช ืฉื ื”ื”ืงืœื˜ื” ื•ืื– ืœื”ื•ืจื™ื“ ื•ืœืฉืœื•ื— ืœื’ื•ื’ืœ ื•ืื– ืœืงื‘ืœ ื—ื–ืจื”

                Y ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                • Y
                  y6714453 @ืœืขื–ื•ืจ ืœื›ื•ืœื ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                  @ืœืขื–ื•ืจ-ืœื›ื•ืœื

                  ืื™ืš ืžืงื‘ืœื™ื ืืช ื”ื”ืงืœื˜ื” ื‘ืงืœื•ืช ืœืฉืจืช?

                  ืฉืœื•ื—ืช API ืขื ื”ื’ื“ืจื•ืช ืžืฉื”ื• ื›ืžื• ื–ื”:

                  type=api
                  api_link=https://
                  api_000=stockname,no,record,/9,,no,yes
                  
                  ืค ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 1
                  • ืค
                    ืคืœื•ืก @y6714453 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                    @y6714453
                    ืืฉืžื— ืœื™ืฆื•ืจ ืื™ืชืš ืงืฉืจ ื‘ื ื•ืฉื!

                    Y ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                    • Y
                      y6714453 @ืคืœื•ืก ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                      @ืคืœื•ืก ื›ืชื‘ ื‘๐ŸŽ™๏ธ๐ŸŽฏ ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ ื‘ืขื‘ืจื™ืช โ€“ ื—ื™ื ื, ืื™ื›ื•ืชื™, ืžื“ื•ื™ืง!!:

                      @y6714453
                      ืืฉืžื— ืœื™ืฆื•ืจ ืื™ืชืš ืงืฉืจ ื‘ื ื•ืฉื!

                      y6714453@gmail.com

                      ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 1
                      • ื”ื•ื–ื›ืจ ืขืœ-ื™ื“ื™  Y y6714453 
                      • ื™
                        ื™ืขืงื‘ 1 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                        ืืฉืžื— ืœืขื–ืจื”. ืขืฉื™ืชื™ ืืช ื”ืงื•ื“ ื”ื–ื” ื‘ืจื ื“ืจ.
                        ืžื” ืืžื•ืจ ืœื”ื™ื•ืช ืžื•ื’ื“ืจ ื‘ืฉืœื•ื—ื” ืฉืœ ื”ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ? (ื–ื” ืงื•ื“ ืฉืืžื•ืจ ืœืฉืœื•ื— ืืœื™ ืืช ื”ืžืจืช ื”ื“ื™ื‘ื•ืจ ืฉืœ ื”ืžืื–ื™ืŸ

                        import os
                        import tempfile
                        import logging
                        import requests
                        from flask import Flask, request, jsonify
                        from pydub import AudioSegment
                        import speech_recognition as sr
                        
                        # ------------------ Logging ------------------
                        logging.basicConfig(
                            level=logging.INFO,
                            format="%(asctime)s | %(levelname)s | %(message)s",
                            datefmt="%H:%M:%S"
                        )
                        
                        app = Flask(__name__)
                        
                        # ------------------ Telegram Config ------------------
                        
                        TELEGRAM_BOT_TOKEN = "***"
                        TELEGRAM_CHAT_ID = "***"
                        
                        # ------------------ Helper Functions ------------------
                        
                        def add_silence(input_path: str) -> AudioSegment:
                            audio = AudioSegment.from_file(input_path, format="wav")
                            silence = AudioSegment.silent(duration=1000)
                            return silence + audio + silence
                        
                        def recognize_speech(audio_segment: AudioSegment) -> str:
                            recognizer = sr.Recognizer()
                            try:
                                with tempfile.NamedTemporaryFile(suffix=".wav", delete=True) as temp_wav:
                                    audio_segment.export(temp_wav.name, format="wav")
                                    with sr.AudioFile(temp_wav.name) as source:
                                        data = recognizer.record(source)
                                    text = recognizer.recognize_google(data, language="he-IL")
                                    logging.info(f"Recognized text: {text}")
                                    return text
                            except sr.UnknownValueError:
                                return ""
                            except Exception as e:
                                logging.error(f"Speech recognition error: {e}")
                                return ""
                        
                        def send_to_telegram(text: str, file_url: str):
                            message = f"๐ŸŽ™๏ธ ื”ื•ื“ืขื” ื—ื“ืฉื” ืžื”ืžืขืจื›ืช:\n\n{text}\n\n๐Ÿ”— ืงื•ื‘ืฅ ื”ื”ืงืœื˜ื”:\n{file_url}"
                            url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
                            requests.post(url, data={"chat_id": TELEGRAM_CHAT_ID, "text": message})
                        
                        # ------------------ API Endpoint ------------------
                        
                        @app.route("/upload_audio", methods=["GET"])
                        def upload_audio():
                            file_url = request.args.get("file_url")
                            if not file_url:
                                return jsonify({"error": "Missing 'file_url' parameter"}), 400
                        
                            logging.info(f"Downloading audio from: {file_url}")
                            try:
                                response = requests.get(file_url, timeout=15)
                                if response.status_code != 200:
                                    return jsonify({"error": "Failed to download audio file"}), 400
                        
                                with tempfile.NamedTemporaryFile(suffix=".wav", delete=True) as temp_input:
                                    temp_input.write(response.content)
                                    temp_input.flush()
                        
                                    processed_audio = add_silence(temp_input.name)
                                    recognized_text = recognize_speech(processed_audio)
                        
                                    if recognized_text:
                                        send_to_telegram(recognized_text, file_url)
                                        return jsonify({"recognized_text": recognized_text})
                                    else:
                                        send_to_telegram(" ืœื ื–ื•ื”ื” ื“ื™ื‘ื•ืจ.", file_url)
                                        return jsonify({"recognized_text": ""})
                        
                            except Exception as e:
                                logging.error(f"Error: {e}")
                                return jsonify({"error": str(e)}), 500
                        
                        # ------------------ Run ------------------
                        if __name__ == "__main__":
                            port = int(os.environ.get("PORT", 5000))
                            app.run(host="0.0.0.0", port=port)
                        
                        Y ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                        • Y
                          y6714453 @ื™ืขืงื‘ 1 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                          @ื™ืขืงื‘-1
                          ื‘ืฉืœื•ื—ื” ืืชื” ืฆืจื™ืš ืœื”ื’ื“ื™ืจ ืฉื™ืฉืœื— ืืช ื”ื”ืงืœื˜ื” ืœืฉืจืช
                          ืœื›ืŸ ืชื’ื“ื™ืจ ื›ืš

                          type=api
                          api_link=ืฉื™ื ืืช ื”ืœื™ื ืง ืฉืœ ื”ืฉืจืช
                          
                          api_000=stockname,no,record,/9,,no,yes
                          
                          ื‘ื™ื˜ื•ืœ ื”ืฉืœื™ื—ื” ื‘ื ื™ืชื•ืง (ืžื•ืžืœืฅ)
                          api_hangup_send=no
                          
                          ืžืขื‘ืจ ื‘ืกื™ื•ื
                          api_end_goto=/ืฉื™ื ืืช ื”ื ืชื™ื‘ ืœืžืขื‘ืจ
                          

                          ื•ืืœ ืชืฉื›ื— ืœื”ืขืœื•ืช ืงื•ื‘ืฅ ืฉืžืข ื‘ืฉื 000 ืœืฉืœื•ื—ื” ืฉืื•ืžืจ ืžืฉื”ื• ื›ืžื• "ืื ื ื”ืงืœื˜ ืืช ื”ื•ื“ืขืชืš, ื•ื‘ืกื™ื•ื ื”ืงืฉ ืกื•ืœืžื™ืช"

                          ื™ ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                          • ื™
                            ื™ืขืงื‘ 1 @y6714453 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™ ื™ืขืงื‘ 1

                            @y6714453 ืชื•ื“ื”!

                            Y C 2 ืชื’ื•ื‘ื•ืช ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                            • Y
                              y6714453 @ื™ืขืงื‘ 1 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™ y6714453

                              @ื™ืขืงื‘-1
                              ื‘ืฉื‘ื™ืœ ืœืžื ื•ืข ืฉื’ื™ืื” - ืชื—ืœื™ืฃ ื‘ื”ื’ื“ืจื•ืช ื”ืฉืœื•ื—ื” ื‘ืžืงื•ื

                              api_000=stockname,no,record,/9,,no,yes
                              

                              ืืช ื–ื”:

                              api_000=file_url,no,record,/9,,no,yes
                              

                              ื‘ื’ืœืœ ืฉื‘ืงื•ื“ - ื”ื•ื ืžื—ืคืฉ ืคืจืžื˜ืจ ื‘ืฉื file_url

                              ืœืคื™ ื”ืฉื•ืจื” ื”ื–ืืช ื‘ืงื•ื“

                                  file_url = request.args.get("file_url")
                              

                              ื™ ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                              • C
                                CUBASE @ื™ืขืงื‘ 1 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                                @ื™ืขืงื‘-1 ื”ืฆืœื—ืช ืœื”ืชืงื™ืŸ ffmpeg ืขืœ Render ื‘ืœื™ ืฉื”ื•ื ืงืจืก ื‘ืชื”ืœื™ืš ื”ื‘ื ื™ื™ื”??

                                ื™ Y 2 ืชื’ื•ื‘ื•ืช ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                                • ื™
                                  ื™ืขืงื‘ 1 @CUBASE ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                                  @CUBASE ื›ืชื‘ ื‘๐ŸŽ™๏ธ๐ŸŽฏ ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ ื‘ืขื‘ืจื™ืช โ€“ ื—ื™ื ื, ืื™ื›ื•ืชื™, ืžื“ื•ื™ืง!!:

                                  ffmpeg

                                  ืœื ืงืจืก

                                  ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                                  • ื™
                                    ื™ืขืงื‘ 1 @y6714453 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                                    @y6714453 ื™ืฉ ืœื™ ื‘ืืžืช ืฉื’ื™ืื•ืช ื‘ื’ืœืœ ื ืชื™ื‘ ืฉื’ื•ื™
                                    ืžื” ื–ื” ื”9 ื‘ืฉื•ืจื” ื”ื–ืืช?
                                    api_000=file_url,no,record,/9,,no,yes

                                    Y ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                                    • Y
                                      y6714453 @ื™ืขืงื‘ 1 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™ y6714453

                                      @ื™ืขืงื‘-1
                                      ืื™ืคื” ื”ื”ืงืœื˜ื” ื ืฉืžืจืช
                                      ืฆื™ื˜ื•ื˜ ืžื”ืืฉื›ื•ืœ ืฉืœ ื”ืžื•ื“ื•ืœ:

                                      ื”ืขืจืš ื”ืจื‘ื™ืขื™ (ื”ืงืœื˜ื”)
                                      ื‘ืขืจืš ื–ื” ื ื™ืชืŸ ืœื”ื’ื“ื™ืจ ื”ื™ื›ืŸ ืชื™ืฉืžืจ ื”ื”ืงืœื˜ื” ื‘ืžืขืจื›ืช
                                      ื‘ืจื™ืจืช ืžื—ื“ืœ ื–ื” ื ืฉืžืจ ื‘ืชื™ืงื™ื™ื” ืฉืžื•ื’ื“ืจืช ื‘-api_dir
                                      ื ื™ืชืŸ ืœื”ื’ื“ื™ืจ ืžื™ืงื•ื ืฉื•ื ื”
                                      ืœื“ื•ื’ืžื”
                                      /8 (ืกืœืฉ ืฉืžื•ื ื”)
                                      ื‘ืžืงืจื” ื›ื–ื” ื”ื”ืงืœื˜ื” ืชื™ืฉืžืจ ื‘ืฉืœื•ื—ื” 8
                                      ื”ืขืจื”: ื—ื•ื‘ื” ืœืฉื™ื / ื‘ื”ืชื—ืœื”. ืืกื•ืจ ืœืฉื™ื / ื‘ืกื•ืฃ

                                      ื™ ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 1
                                      • Y
                                        y6714453 @CUBASE ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                                        @CUBASE ื›ืชื‘ ื‘๐ŸŽ™๏ธ๐ŸŽฏ ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ ื‘ืขื‘ืจื™ืช โ€“ ื—ื™ื ื, ืื™ื›ื•ืชื™, ืžื“ื•ื™ืง!!:

                                        @ื™ืขืงื‘-1 ื”ืฆืœื—ืช ืœื”ืชืงื™ืŸ ffmpeg ืขืœ Render ื‘ืœื™ ืฉื”ื•ื ืงืจืก ื‘ืชื”ืœื™ืš ื”ื‘ื ื™ื™ื”??

                                        ืœืžื” ืฉื™ืงืจื•ืก? ื–ื” ื ื—ืฉื‘ ืกืคืจื™ื” ื›ื‘ื“ื”, ืื• ืœื ื ืชืžื›ืช??

                                        C ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                                        • ื™
                                          ื™ืขืงื‘ 1 @y6714453 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™

                                          @y6714453 ืืžื•ืจื” ืœื”ื™ื•ืช ืจืฉื•ืžื” ืฉื ื”ืฉืœื•ื—ื” ืฉื‘ื” ื”ื”ืงืœื˜ื” ืชื™ืฉืžืจ ืื• ืฉืžืžื ื” ื™ืงื— ืืช ื”ื”ืงืœื˜ื” ืœื”ืžืจื”? ื”ื•ื ื›ืœ ื”ื–ืžืŸ ืžื—ื–ื™ืจ ืฉื’ื™ืื” ืฉืœื ืžื•ืฆื ืืช ื”ื ืชื™ื‘ 6&file_url=/9/000.wav

                                          Y ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                                          • Y
                                            y6714453 @ื™ืขืงื‘ 1 ื ืขืจืš ืœืื—ืจื•ื ื” ืขืœ ื™ื“ื™ y6714453

                                            @ื™ืขืงื‘-1 ื›ืชื‘ ื‘๐ŸŽ™๏ธ๐ŸŽฏ ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ ื‘ืขื‘ืจื™ืช โ€“ ื—ื™ื ื, ืื™ื›ื•ืชื™, ืžื“ื•ื™ืง!!:

                                            @y6714453 ืืžื•ืจื” ืœื”ื™ื•ืช ืจืฉื•ืžื” ืฉื ื”ืฉืœื•ื—ื” ืฉื‘ื” ื”ื”ืงืœื˜ื” ืชื™ืฉืžืจ ืื• ืฉืžืžื ื” ื™ืงื— ืืช ื”ื”ืงืœื˜ื” ืœื”ืžืจื”? ื”ื•ื ื›ืœ ื”ื–ืžืŸ ืžื—ื–ื™ืจ ืฉื’ื™ืื” ืฉืœื ืžื•ืฆื ืืช ื”ื ืชื™ื‘ 6&file_url=/9/000.wav

                                            ื”ืฉืœื•ื—ื” ืฉื‘ื” ื”ื”ืงืœื˜ื” ืชื™ืฉืžืจ - ื‘ืœื™ ืงืฉืจ ืœืžื” ืฉื”ืฉืจืช ืžืงื‘ืœ, (ืืชื” ื™ื›ื•ืœ ื’ื ืœื”ืฉืื™ืจ ืืช ื”ืขืจืš ืจื™ืง ื•ืื– ื”ื”ืงืœื˜ื” ืชื™ืฉืžืจ ื‘ืชื™ืงื™ื™ื” api_dir).
                                            ื–ื” ืœื ื”ืกื™ื‘ื” ืœืฉื’ื™ืื”.

                                            ืชืขืœื” ืคื” ืืช ื”ืฉื’ื™ืื” ืฉืืชื” ืžืงื‘ืœ

                                            ื™ ืชื’ื•ื‘ื” 1 ืชื’ื•ื‘ื” ืื—ืจื•ื ื” ืชื’ื•ื‘ื” ืฆื™ื˜ื•ื˜ 0
                                            • ืคื•ืกื˜ ืจืืฉื•ืŸ
                                              ืคื•ืกื˜ ืื—ืจื•ืŸ