Update app.py
Browse files
app.py
CHANGED
|
@@ -2,11 +2,19 @@ import streamlit as st
|
|
| 2 |
import speech_recognition as sr
|
| 3 |
from langdetect import detect
|
| 4 |
from transformers import pipeline
|
| 5 |
-
import
|
|
|
|
| 6 |
from google.cloud import speech
|
| 7 |
import os
|
| 8 |
|
| 9 |
-
# Load
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
grammar_correction_pipeline = pipeline("text2text-generation", model="facebook/bart-large-mnli")
|
| 11 |
|
| 12 |
# Function to transcribe speech to text
|
|
|
|
| 2 |
import speech_recognition as sr
|
| 3 |
from langdetect import detect
|
| 4 |
from transformers import pipeline
|
| 5 |
+
import spacy
|
| 6 |
+
import spacy.cli
|
| 7 |
from google.cloud import speech
|
| 8 |
import os
|
| 9 |
|
| 10 |
+
# Load spaCy model dynamically if not already installed
|
| 11 |
+
if not spacy.util.is_package('en_core_web_sm'):
|
| 12 |
+
spacy.cli.download('en_core_web_sm')
|
| 13 |
+
|
| 14 |
+
# Load spaCy for grammar analysis
|
| 15 |
+
nlp = spacy.load('en_core_web_sm')
|
| 16 |
+
|
| 17 |
+
# Load Hugging Face Grammar Correction Model
|
| 18 |
grammar_correction_pipeline = pipeline("text2text-generation", model="facebook/bart-large-mnli")
|
| 19 |
|
| 20 |
# Function to transcribe speech to text
|