Spaces:
Runtime error
Runtime error
File size: 866 Bytes
ab4fe3f 781a081 ab4fe3f f09db0d ab4fe3f 781a081 ab4fe3f 781a081 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from fake_content_classifier import FakeContentClassifier
import speech_recognition as sr
import gradio as gr
# Create an instance of the FakeContentClassifier class
fake_content_classifier = FakeContentClassifier(
model_path='Models/Fake_content_model.hdf5',
tokenizer_path='Tokenizers/tokenizer.pkl'
)
def Prediction(text,audio):
if not text:
r = sr.Recognizer()
sample_rate, audio_data = audio
audio = sr.AudioData(audio_data, sample_rate=sample_rate,sample_width=2)
try:
text = r.recognize_google(audio, language='ur')
return fake_content_classifier.predict(text)
except:
return "sorry could not recognize what you said"
else:
return fake_content_classifier.predict(text)
gr.Interface(fn=Prediction,inputs=["text","audio"],outputs="text",share=True).launch()
|