sahandkh1419 commited on
Commit
71c7113
1 Parent(s): be8df39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -65,7 +65,8 @@ st.markdown(description, unsafe_allow_html=True)
65
  st.write('------')
66
 
67
 
68
-
 
69
 
70
  def cosine_sim(text1, text2):
71
  vectorizer = TfidfVectorizer().fit_transform([text1, text2])
@@ -81,11 +82,9 @@ def take_challenge(music_file, typed_lyrics, key, language):
81
  f.write(audio_value.getbuffer())
82
 
83
  if language == "en":
84
- model = whisper.load_model("base.en")
85
- user_lyrics = model.transcribe("user_sing.mp3", language=language)["text"]
86
  else:
87
- model = Model.load("hezarai/whisper-small-fa")
88
- user_lyrics = model.predict("user_sing.mp3")[0]["text"]
89
 
90
  st.write(user_lyrics)
91
  similarity_score = cosine_sim(typed_lyrics, user_lyrics)
 
65
  st.write('------')
66
 
67
 
68
+ english_model = whisper.load_model("base.en")
69
+ persian_model = Model.load("hezarai/whisper-small-fa")
70
 
71
  def cosine_sim(text1, text2):
72
  vectorizer = TfidfVectorizer().fit_transform([text1, text2])
 
82
  f.write(audio_value.getbuffer())
83
 
84
  if language == "en":
85
+ user_lyrics = english_model.transcribe("user_sing.mp3", language=language)["text"]
 
86
  else:
87
+ user_lyrics = persian_model.predict("user_sing.mp3")[0]["text"]
 
88
 
89
  st.write(user_lyrics)
90
  similarity_score = cosine_sim(typed_lyrics, user_lyrics)