Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,8 @@ import logging
|
|
| 5 |
import traceback
|
| 6 |
import sys
|
| 7 |
from audio_processing import AudioProcessor
|
|
|
|
|
|
|
| 8 |
|
| 9 |
logging.basicConfig(
|
| 10 |
level=logging.INFO,
|
|
@@ -40,6 +42,8 @@ def load_summarization_model():
|
|
| 40 |
logger.error(f"Failed to load summarization model: {str(e)}")
|
| 41 |
return None
|
| 42 |
|
|
|
|
|
|
|
| 43 |
def process_audio(audio_file, translate=False):
|
| 44 |
"""Process audio file"""
|
| 45 |
try:
|
|
@@ -73,6 +77,8 @@ def process_audio(audio_file, translate=False):
|
|
| 73 |
logger.error(f"Audio processing failed: {str(e)}")
|
| 74 |
raise gr.Error(f"Processing failed: {str(e)}")
|
| 75 |
|
|
|
|
|
|
|
| 76 |
def summarize_text(text):
|
| 77 |
"""Summarize text"""
|
| 78 |
try:
|
|
@@ -86,6 +92,8 @@ def summarize_text(text):
|
|
| 86 |
logger.error(f"Summarization failed: {str(e)}")
|
| 87 |
return "Error occurred during summarization."
|
| 88 |
|
|
|
|
|
|
|
| 89 |
def answer_question(context, question):
|
| 90 |
"""Answer questions about the text"""
|
| 91 |
try:
|
|
@@ -104,9 +112,10 @@ def answer_question(context, question):
|
|
| 104 |
logger.error(f"Q&A failed: {str(e)}")
|
| 105 |
return f"Error occurred during Q&A process: {str(e)}"
|
| 106 |
|
|
|
|
| 107 |
# Create Gradio interface
|
| 108 |
with gr.Blocks() as iface:
|
| 109 |
-
gr.Markdown("#
|
| 110 |
|
| 111 |
with gr.Row():
|
| 112 |
with gr.Column():
|
|
|
|
| 5 |
import traceback
|
| 6 |
import sys
|
| 7 |
from audio_processing import AudioProcessor
|
| 8 |
+
import spaces
|
| 9 |
+
|
| 10 |
|
| 11 |
logging.basicConfig(
|
| 12 |
level=logging.INFO,
|
|
|
|
| 42 |
logger.error(f"Failed to load summarization model: {str(e)}")
|
| 43 |
return None
|
| 44 |
|
| 45 |
+
|
| 46 |
+
@spaces.GPU(duration=60)
|
| 47 |
def process_audio(audio_file, translate=False):
|
| 48 |
"""Process audio file"""
|
| 49 |
try:
|
|
|
|
| 77 |
logger.error(f"Audio processing failed: {str(e)}")
|
| 78 |
raise gr.Error(f"Processing failed: {str(e)}")
|
| 79 |
|
| 80 |
+
|
| 81 |
+
@spaces.GPU(duration=60)
|
| 82 |
def summarize_text(text):
|
| 83 |
"""Summarize text"""
|
| 84 |
try:
|
|
|
|
| 92 |
logger.error(f"Summarization failed: {str(e)}")
|
| 93 |
return "Error occurred during summarization."
|
| 94 |
|
| 95 |
+
|
| 96 |
+
@spaces.GPU(duration=60)
|
| 97 |
def answer_question(context, question):
|
| 98 |
"""Answer questions about the text"""
|
| 99 |
try:
|
|
|
|
| 112 |
logger.error(f"Q&A failed: {str(e)}")
|
| 113 |
return f"Error occurred during Q&A process: {str(e)}"
|
| 114 |
|
| 115 |
+
|
| 116 |
# Create Gradio interface
|
| 117 |
with gr.Blocks() as iface:
|
| 118 |
+
gr.Markdown("# Automatic Speech Recognition for Indic Languages")
|
| 119 |
|
| 120 |
with gr.Row():
|
| 121 |
with gr.Column():
|