Spaces:
Runtime error
Runtime error
Download app.py from faizeeb/Fake_content_Detection: direct link, hf CLI and curl.
- Browser
- Download file 866 Bytes
-
https://huggingface.co/spaces/faizeeb/Fake_content_Detection/resolve/main/app.py
- Command line
-
hf download hf://spaces/faizeeb/Fake_content_Detection/app.py
-
curl -L -o app.py https://huggingface.co/spaces/faizeeb/Fake_content_Detection/resolve/main/app.py
866 Bytes
| 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() | |