fargerm commited on
Commit
54b1b7d
1 Parent(s): f37585c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -35,15 +35,10 @@ def load_translation_model(lang_code):
35
 
36
  st.title("TextLangAudioGenerator")
37
 
38
- # Audio input
39
- uploaded_file = st.file_uploader("Upload an audio file", type=["wav", "mp3"])
40
-
41
- if uploaded_file:
42
- audio_bytes = uploaded_file.read()
43
- result = whisper_pipe(audio_bytes)
44
- text_input = result["text"]
45
- st.write(f"Transcribed text: {text_input}")
46
 
 
47
  # Select target language
48
  target_lang = st.selectbox(
49
  "Select target language",
@@ -52,6 +47,7 @@ if uploaded_file:
52
  )
53
 
54
  if target_lang:
 
55
  model, tokenizer = load_translation_model(target_lang)
56
  inputs = tokenizer(text_input, return_tensors="pt")
57
  translated = model.generate(**inputs)
@@ -65,7 +61,4 @@ if uploaded_file:
65
 
66
  st.audio(audio_path, format="audio/wav")
67
 
68
- # Streamlit run command
69
- if __name__ == "__main__":
70
- st.write("Running Streamlit app...")
71
 
 
35
 
36
  st.title("TextLangAudioGenerator")
37
 
38
+ # Text input
39
+ text_input = st.text_area("Enter text in English")
 
 
 
 
 
 
40
 
41
+ if text_input:
42
  # Select target language
43
  target_lang = st.selectbox(
44
  "Select target language",
 
47
  )
48
 
49
  if target_lang:
50
+ # Load translation model
51
  model, tokenizer = load_translation_model(target_lang)
52
  inputs = tokenizer(text_input, return_tensors="pt")
53
  translated = model.generate(**inputs)
 
61
 
62
  st.audio(audio_path, format="audio/wav")
63
 
 
 
 
64