abdullahedcults commited on
Commit
e124ded
1 Parent(s): 2faa8c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -23
app.py CHANGED
@@ -44,31 +44,9 @@ def transcribe(audio):
44
 
45
  def main():
46
  st.title("Translate and Transcribe Audio")
47
- st.subheader("Try by Uploading Audio")
48
-
49
-
50
- st.write("Upload your Audio")
51
-
52
- uploaded_file = st.file_uploader("(WAV format)", type=["wav"])
53
- if uploaded_file is not None:
54
- with st.spinner("Transcribing and translating audio... Please wait."):
55
- audio_path = "uploaded_audio.wav"
56
- with open(audio_path, "wb") as f:
57
- f.write(uploaded_file.getvalue())
58
-
59
- result_text, translated_text = transcribe(audio_path)
60
-
61
- st.subheader("Original Text (English):")
62
- st.write(result_text)
63
-
64
- st.subheader("Translated Text (Hindi):")
65
- st.write(translated_text)
66
-
67
- # Remove the temporary audio file
68
- os.remove(audio_path)
69
 
70
  st.subheader("Try by Recording Custom Audio")
71
- st.write("Click the 'Start Recording' button to start recording your voice. Press 'Stop Recording' when done.")
72
 
73
  audio_bytes = audio_recorder()
74
  if audio_bytes:
@@ -87,5 +65,26 @@ def main():
87
  st.subheader("Translated Text (Hindi):")
88
  st.write(translated_text)
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  if __name__ == "__main__":
91
  main()
 
44
 
45
  def main():
46
  st.title("Translate and Transcribe Audio")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  st.subheader("Try by Recording Custom Audio")
49
+ st.write("Click the 'Start Recording' button to start recording your voice. Press Same Button when done.")
50
 
51
  audio_bytes = audio_recorder()
52
  if audio_bytes:
 
65
  st.subheader("Translated Text (Hindi):")
66
  st.write(translated_text)
67
 
68
+
69
+ st.subheader("Try by Uploading Audio")
70
+ st.write("Upload your Audio")
71
+ uploaded_file = st.file_uploader("(WAV format)", type=["wav"])
72
+ if uploaded_file is not None:
73
+ with st.spinner("Transcribing and translating audio... Please wait."):
74
+ audio_path = "uploaded_audio.wav"
75
+ with open(audio_path, "wb") as f:
76
+ f.write(uploaded_file.getvalue())
77
+
78
+ result_text, translated_text = transcribe(audio_path)
79
+
80
+ st.subheader("Original Text (English):")
81
+ st.write(result_text)
82
+
83
+ st.subheader("Translated Text (Hindi):")
84
+ st.write(translated_text)
85
+
86
+ # Remove the temporary audio file
87
+ os.remove(audio_path)
88
+
89
  if __name__ == "__main__":
90
  main()