shukdevdatta123 commited on
Commit
f15a385
ยท
verified ยท
1 Parent(s): a8004f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -23
app.py CHANGED
@@ -5,7 +5,7 @@ import soundfile as sf
5
  import io
6
 
7
  # Streamlit App UI Setup
8
- st.title("Text-to-Speech with Kokoro")
9
 
10
  # Expander section to display information in multiple languages
11
  with st.expander("Sample Prompt!"):
@@ -22,34 +22,40 @@ with st.expander("Sample Prompt!"):
22
 
23
  st.sidebar.header("Configuration & Instructions")
24
 
25
- # Sidebar Instructions
26
  st.sidebar.markdown("""
27
  ### How to Use the Text-to-Speech App:
28
- 1. **Enter Text**: In the main text area, input any text that you want the model to convert to speech.
29
-
30
- 2. **Select Language**:
31
- - Choose the language of the text you are entering. Available options include:
32
- - ๐Ÿ‡บ๐Ÿ‡ธ American English (`a`)
33
- - ๐Ÿ‡ฌ๐Ÿ‡ง British English (`b`)
34
- - ๐Ÿ‡ช๐Ÿ‡ธ Spanish (`e`)
35
- - ๐Ÿ‡ซ๐Ÿ‡ท French (`f`)
36
- - ๐Ÿ‡ฎ๐Ÿ‡ณ Hindi (`h`)
37
- - ๐Ÿ‡ฎ๐Ÿ‡น Italian (`i`)
38
- - ๐Ÿ‡ง๐Ÿ‡ท Brazilian Portuguese (`p`)
39
- - ๐Ÿ‡จ๐Ÿ‡ณ Mandarin Chinese (`z`)
40
- - ๐Ÿ‡ฏ๐Ÿ‡ต Japanese (`j`)
41
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  3. **Select Voice**:
43
- - Choose the voice style for the speech. You can pick different voices based on tone and gender, such as `af_heart`, `af_joy`, etc.
44
 
45
- 4. **Adjust Speed**:
46
- - Use the speed slider to change how fast the speech is generated. You can set it between `0.5x` to `2.0x`, where `1.0x` is the normal speed.
 
47
  5. **Generate Speech**:
48
- - After configuring the settings, click on the **"Generate Audio"** button. The app will process your text and produce speech audio accordingly.
49
-
50
- 6. **Download**:
51
- - Once the audio is generated, you can play it directly in the app or download it as a `.wav` file by clicking on the **"Download Audio"** button.
52
- Enjoy experimenting with the text-to-speech conversion, and feel free to try different voices, speeds, and languages!
 
 
 
 
 
53
  """)
54
 
55
  # User input for text, language, and voice settings
 
5
  import io
6
 
7
  # Streamlit App UI Setup
8
+ st.title("Text-to-Speech Translator with Kokoro")
9
 
10
  # Expander section to display information in multiple languages
11
  with st.expander("Sample Prompt!"):
 
22
 
23
  st.sidebar.header("Configuration & Instructions")
24
 
 
25
  st.sidebar.markdown("""
26
  ### How to Use the Text-to-Speech App:
27
+ 1. **Enter Text**:
28
+ - Type or paste the text you want to convert to speech in the main text area.
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ 2. **Select Language**:
31
+ - Choose the language of the input text. The available language options include:
32
+ - ๐Ÿ‡บ๐Ÿ‡ธ **English** (American English)
33
+ - ๐Ÿ‡ฌ๐Ÿ‡ง **British English**
34
+ - ๐Ÿ‡ช๐Ÿ‡ธ **Spanish**
35
+ - ๐Ÿ‡ซ๐Ÿ‡ท **French**
36
+ - ๐Ÿ‡ฎ๐Ÿ‡ณ **Hindi**
37
+ - ๐Ÿ‡ฎ๐Ÿ‡น **Italian**
38
+ - ๐Ÿ‡ง๐Ÿ‡ท **Portuguese** (Brazilian)
39
+ - ๐Ÿ‡จ๐Ÿ‡ณ **Chinese** (Mandarin)
40
+ - ๐Ÿ‡ฏ๐Ÿ‡ต **Japanese**
41
+
42
  3. **Select Voice**:
43
+ - Choose the voice you want for the speech. There are multiple voice styles based on tone and gender (e.g., `af_heart`, `af_joy`, etc.).
44
 
45
+ 4. **Adjust Speech Speed**:
46
+ - Use the slider to adjust how fast the speech will be generated. The speed can be set from `0.5x` to `2.0x`, with `1.0x` being the default normal speed.
47
+
48
  5. **Generate Speech**:
49
+ - Once you've selected the text, language, voice, and speed, click the **"Generate Audio"** button. The app will process the text and generate the speech.
50
+
51
+ 6. **Download Audio**:
52
+ - After the audio is generated, you can play it directly within the app or download it as a `.wav` file by clicking the **"Download Audio"** button.
53
+
54
+ ### Additional Features:
55
+ - **Text Translation**:
56
+ - The app can automatically translate the text to English before generating audio. After the translation, you will hear the audio in English with your chosen voice.
57
+
58
+ Enjoy exploring different languages, voices, and speeds with the text-to-speech conversion!
59
  """)
60
 
61
  # User input for text, language, and voice settings