Spaces:
Build error
Build error
BilalSardar
commited on
Commit
•
5ad2e45
1
Parent(s):
6b89e62
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ import spacy
|
|
36 |
warnings.filterwarnings("ignore")
|
37 |
|
38 |
def Process_audio(fileName):
|
39 |
-
|
40 |
txtf=open("The_audio.txt","w+")
|
41 |
myaudio=AudioSegment.from_wav(fileName)
|
42 |
chunks_length_ms=8000
|
@@ -53,12 +53,12 @@ def Process_audio(fileName):
|
|
53 |
try:
|
54 |
rec=r.recognize_google(audio_listened)
|
55 |
txtf.write(rec+".")
|
56 |
-
|
57 |
except sr.UnknownValueError:
|
58 |
print("I dont recognize your audio")
|
59 |
except sr.RequestError as e:
|
60 |
print("could not get result")
|
61 |
-
|
62 |
try:
|
63 |
os.makedirs("chunked")
|
64 |
except:
|
@@ -248,9 +248,9 @@ radiobutton = gr.inputs.Radio(["Wordnet", "Gensim"])
|
|
248 |
|
249 |
def generate_question(context1,radiobutton):
|
250 |
try:
|
251 |
-
|
252 |
-
f = open("The_audio.txt", "r")
|
253 |
-
context=f.read()
|
254 |
summary_text = summarizer(context,summary_model,summary_tokenizer)
|
255 |
for wrp in wrap(summary_text, 150):
|
256 |
print (wrp)
|
|
|
36 |
warnings.filterwarnings("ignore")
|
37 |
|
38 |
def Process_audio(fileName):
|
39 |
+
text=''
|
40 |
txtf=open("The_audio.txt","w+")
|
41 |
myaudio=AudioSegment.from_wav(fileName)
|
42 |
chunks_length_ms=8000
|
|
|
53 |
try:
|
54 |
rec=r.recognize_google(audio_listened)
|
55 |
txtf.write(rec+".")
|
56 |
+
text+=rec+"."
|
57 |
except sr.UnknownValueError:
|
58 |
print("I dont recognize your audio")
|
59 |
except sr.RequestError as e:
|
60 |
print("could not get result")
|
61 |
+
return text
|
62 |
try:
|
63 |
os.makedirs("chunked")
|
64 |
except:
|
|
|
248 |
|
249 |
def generate_question(context1,radiobutton):
|
250 |
try:
|
251 |
+
|
252 |
+
#f = open("The_audio.txt", "r")
|
253 |
+
context=UrlToAudio(context1)#f.read()
|
254 |
summary_text = summarizer(context,summary_model,summary_tokenizer)
|
255 |
for wrp in wrap(summary_text, 150):
|
256 |
print (wrp)
|