Spaces:
Running
Running
sahandkh1419
commited on
Commit
•
8b0f701
1
Parent(s):
71c7113
Update app.py
Browse files
app.py
CHANGED
@@ -65,8 +65,8 @@ st.markdown(description, unsafe_allow_html=True)
|
|
65 |
st.write('------')
|
66 |
|
67 |
|
68 |
-
|
69 |
-
|
70 |
|
71 |
def cosine_sim(text1, text2):
|
72 |
vectorizer = TfidfVectorizer().fit_transform([text1, text2])
|
@@ -82,8 +82,10 @@ def take_challenge(music_file, typed_lyrics, key, language):
|
|
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)
|
|
|
65 |
st.write('------')
|
66 |
|
67 |
|
68 |
+
|
69 |
+
|
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 |
+
english_model = whisper.load_model("base.en")
|
86 |
user_lyrics = english_model.transcribe("user_sing.mp3", language=language)["text"]
|
87 |
else:
|
88 |
+
persian_model = Model.load("hezarai/whisper-small-fa")
|
89 |
user_lyrics = persian_model.predict("user_sing.mp3")[0]["text"]
|
90 |
|
91 |
st.write(user_lyrics)
|