Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,6 +48,9 @@ def audio_to_text(audio_file):
|
|
| 48 |
# Function to summarize text
|
| 49 |
def summarize_text(text):
|
| 50 |
try:
|
|
|
|
|
|
|
|
|
|
| 51 |
summary = summarizer(text, max_length=130, min_length=30, do_sample=False)
|
| 52 |
return summary[0]['summary_text']
|
| 53 |
except Exception as e:
|
|
@@ -79,6 +82,10 @@ def main():
|
|
| 79 |
if summary:
|
| 80 |
st.subheader("Summary:")
|
| 81 |
st.write(summary)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
if __name__ == "__main__":
|
| 84 |
main()
|
|
|
|
| 48 |
# Function to summarize text
|
| 49 |
def summarize_text(text):
|
| 50 |
try:
|
| 51 |
+
if len(text.strip()) < 10: # Check if the text is too short
|
| 52 |
+
st.warning("The transcribed text is too short to summarize.")
|
| 53 |
+
return None
|
| 54 |
summary = summarizer(text, max_length=130, min_length=30, do_sample=False)
|
| 55 |
return summary[0]['summary_text']
|
| 56 |
except Exception as e:
|
|
|
|
| 82 |
if summary:
|
| 83 |
st.subheader("Summary:")
|
| 84 |
st.write(summary)
|
| 85 |
+
else:
|
| 86 |
+
st.warning("No summary generated. The transcribed text may be too short or unclear.")
|
| 87 |
+
else:
|
| 88 |
+
st.error("Failed to transcribe the audio. Please check the file format and try again.")
|
| 89 |
|
| 90 |
if __name__ == "__main__":
|
| 91 |
main()
|