Niansuh commited on
Commit
feb8aa2
·
verified ·
1 Parent(s): b2d49c3

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +11 -10
templates/index.html CHANGED
@@ -57,12 +57,13 @@
57
  }
58
  .preview-section {
59
  margin-top: 30px;
60
- text-align: center;
 
 
61
  }
62
- audio {
63
  width: 100%;
64
- max-width: 400px;
65
- margin: 20px 0;
66
  }
67
  .download-button {
68
  background: #764ba2;
@@ -84,23 +85,23 @@
84
  <div class="container">
85
  <h1>Text to Speech Converter</h1>
86
  <form method="post">
87
- <textarea name="text" placeholder="Enter your text here..."></textarea>
88
  <select name="voice">
89
- {% for voice in voices %}
90
- <option value="{{ voice }}">{{ voice }}</option>
91
  {% endfor %}
92
  </select>
93
  <button type="submit" class="button">Generate Audio</button>
94
  </form>
95
 
96
- {% if audio_url %}
97
  <div class="preview-section">
98
  <h2>Preview Your Audio</h2>
99
  <audio controls>
100
- <source src="{{ audio_url }}" type="audio/mpeg">
101
  Your browser does not support the audio element.
102
  </audio>
103
- <a href="{{ audio_url }}" download="{{ download_filename }}" class="button download-button">Download MP3</a>
104
  </div>
105
  {% endif %}
106
 
 
57
  }
58
  .preview-section {
59
  margin-top: 30px;
60
+ padding: 20px;
61
+ background: #f8f9fa;
62
+ border-radius: 8px;
63
  }
64
+ .preview-section audio {
65
  width: 100%;
66
+ margin-bottom: 15px;
 
67
  }
68
  .download-button {
69
  background: #764ba2;
 
85
  <div class="container">
86
  <h1>Text to Speech Converter</h1>
87
  <form method="post">
88
+ <textarea name="text" placeholder="Enter your text here...">{{ text if text else '' }}</textarea>
89
  <select name="voice">
90
+ {% for voice_option in voices %}
91
+ <option value="{{ voice_option }}" {% if voice_option == voice %}selected{% endif %}>{{ voice_option }}</option>
92
  {% endfor %}
93
  </select>
94
  <button type="submit" class="button">Generate Audio</button>
95
  </form>
96
 
97
+ {% if audio_file %}
98
  <div class="preview-section">
99
  <h2>Preview Your Audio</h2>
100
  <audio controls>
101
+ <source src="/audio/{{ audio_file.split('/')[-1] }}" type="audio/mpeg">
102
  Your browser does not support the audio element.
103
  </audio>
104
+ <a href="/audio/{{ audio_file.split('/')[-1] }}" download="{{ voice }}_output.mp3" class="button download-button">Download MP3</a>
105
  </div>
106
  {% endif %}
107