Spaces:
Runtime error
Runtime error
bhavitvyamalik
commited on
Commit
•
a39f95b
1
Parent(s):
c00e2e2
layout
Browse files- apps/mic.py +10 -9
- sections/usage.md +3 -1
apps/mic.py
CHANGED
@@ -124,7 +124,7 @@ def app(state):
|
|
124 |
|
125 |
sequence = ['']
|
126 |
if new_col2.button("Generate Caption", help="Generate a caption in the specified language."):
|
127 |
-
with st.spinner("Generating Sequence..."):
|
128 |
sequence = generate_sequence(transformed_image, lang_id, num_beams, temperature, top_p, do_sample, top_k, max_length)
|
129 |
# print(sequence)
|
130 |
|
@@ -136,11 +136,12 @@ def app(state):
|
|
136 |
new_col2.write(
|
137 |
"**English Translation**: "+ sequence[0] if lang_id=="en" else translate(sequence[0])
|
138 |
)
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
124 |
|
125 |
sequence = ['']
|
126 |
if new_col2.button("Generate Caption", help="Generate a caption in the specified language."):
|
127 |
+
with st.spinner("Generating Sequence... This might take a while, thank you for your patience!"):
|
128 |
sequence = generate_sequence(transformed_image, lang_id, num_beams, temperature, top_p, do_sample, top_k, max_length)
|
129 |
# print(sequence)
|
130 |
|
|
|
136 |
new_col2.write(
|
137 |
"**English Translation**: "+ sequence[0] if lang_id=="en" else translate(sequence[0])
|
138 |
)
|
139 |
+
with new_col2:
|
140 |
+
try:
|
141 |
+
clean_text = re.sub(r'[^A-Za-z0-9 ]+', '', sequence[0])
|
142 |
+
# st.write("**Cleaned Text**: ",clean_text)
|
143 |
+
audio_bytes = voicerss_tts(clean_text, lang_id)
|
144 |
+
st.write("audio for the generated caption")
|
145 |
+
st.audio(audio_bytes)
|
146 |
+
except:
|
147 |
+
st.info("Unabled to generate audio. Please try again in some time.")
|
sections/usage.md
CHANGED
@@ -4,4 +4,6 @@
|
|
4 |
|
5 |
- The sidebar contains generation parameters such as `Number of Beams`, `Top-P`, `Temperature` which will be used when generating the caption.
|
6 |
|
7 |
-
-
|
|
|
|
|
|
4 |
|
5 |
- The sidebar contains generation parameters such as `Number of Beams`, `Top-P`, `Temperature` which will be used when generating the caption.
|
6 |
|
7 |
+
- One can choose the `Language` of the caption in the dropdown below to generate a caption in that particular language.
|
8 |
+
|
9 |
+
- Lastly, keeping in mind its intended future scope for visually challenged people, we also provide audio clip for the generated sequence.
|