0

I'm using WAMP server and i have configured it to run python scripts and those scripts are executing but i was trying to run below script, this script is executing in windows terminal but when i try to execute it from browser with the help of wamp server then i'm getting this error :

Apache error log :

[Sat Nov 27 11:12:01.808031 2021] [cgi:error] [pid 6040:tid 1220] [client ::1:56483] End of script output before headers: test_nm.py

Apache access log :

::1 - - [27/Nov/2021:11:11:57 +0530] "-" 408 -
::1 - - [27/Nov/2021:11:12:01 +0530] "GET /test_nm.py HTTP/1.1" 500 653

Code

#!C:\Program Files\Python36\python.exe

print("Content-Type: text/html\n")

import numpy as np
import wave
from deepspeech import Model
from scipy.io import wavfile as wav
#import speech_recognition as sr

audio_file = "C:/deepspeechwk/audio/8455-210777-0068.wav"
ds = Model('C:/deepspeechwk/deepspeech-0.6.0-models/output_graph.pb',500)
ds.enableDecoderWithLM('C:/deepspeechwk/deepspeech-0.6.0-models/lm.binary','C:/deepspeechwk/deepspeech-0.6.0-models/trie', 0.75, 1.85)
rate, audio = wav.read(audio_file)
print(audio)
transcript =ds.stt(audio)
#print(transcript)

f = open("transcribe_text.txt", "a")
f.write(str(transcript))
f.close()

Screenshot :

enter image description here

Any solution to resolve this issue is highly appreciated, Thanks

8
  • It seems that somehow printing the header is incorrect according to this: stackoverflow.com/a/22308061/7828101 . Does print("Content-Type: text/html\n") works for all your other python scripts? Does remove all but the imports give the same exception ? Commented Nov 27, 2021 at 6:46
  • @manaclan: When i remove import then there is no error. print("Content-Type: text/html\n") is working in other scripts Commented Nov 27, 2021 at 6:54
  • you should try comment out each line to narrow down the problem and post it here. I can't help much as I don't have your code Commented Nov 27, 2021 at 6:59
  • @manaclan In my question i have added the code Commented Nov 27, 2021 at 7:00
  • I mean, try comment all your code and then uncomment each line until the program break. Update the line that cause the program to break onto your question Commented Nov 27, 2021 at 7:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.