Sib83 commited on
Commit
e77a2ce
·
verified ·
1 Parent(s): e1ef4c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
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 io
 
6
  from google.cloud import speech
7
  import os
8
 
9
- # Load Hugging Face Grammar Correction Model (using a general grammar correction model as example)
 
 
 
 
 
 
 
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