Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import gradio as gr
|
2 |
-
import asyncio
|
3 |
import os
|
4 |
import thinkingframes
|
5 |
import soundfile as sf
|
@@ -13,15 +12,12 @@ from utils import get_image_html, collect_student_info
|
|
13 |
from database_functions import add_user_privacy, add_submission
|
14 |
from tab_teachers_dashboard import create_teachers_dashboard_tab
|
15 |
from config import CLASS_OPTIONS
|
16 |
-
from concurrent.futures import ThreadPoolExecutor
|
17 |
import spaces
|
18 |
from streaming_stt_nemo import Model
|
19 |
import edge_tts
|
20 |
import tempfile
|
21 |
|
22 |
-
#
|
23 |
-
os.system("pip install streaming-stt-nemo edge_tts")
|
24 |
-
|
25 |
load_dotenv()
|
26 |
|
27 |
default_lang = "en"
|
@@ -36,8 +32,6 @@ llm = gr.load("meta-llama/Meta-Llama-3-8B", src="models")
|
|
36 |
image_path = "picturePerformance.jpg"
|
37 |
img_html = get_image_html(image_path)
|
38 |
|
39 |
-
executor = ThreadPoolExecutor()
|
40 |
-
|
41 |
@spaces.GPU(duration=120)
|
42 |
def transcribe(audio):
|
43 |
lang = "en"
|
@@ -58,7 +52,6 @@ def generate_feedback(user_id, question_choice, strategy_choice, message, feedba
|
|
58 |
"content": message
|
59 |
}]
|
60 |
|
61 |
-
# Use the loaded model for generating feedback
|
62 |
feedback = llm(conversation)[0]["generated_text"]
|
63 |
|
64 |
questionNo = current_question_index + 1
|
@@ -115,7 +108,6 @@ def predict(question_choice, strategy_choice, feedback_level, audio):
|
|
115 |
logging.error(f"An error occurred: {str(e)}", exc_info=True)
|
116 |
return [("Oral Coach ⚡ϞϞ(๑⚈ ․̫ ⚈๑)∩ ⚡", "An error occurred. Please try again or seek assistance.")], current_audio_output
|
117 |
|
118 |
-
# Modify the toggle_oral_coach_visibility function to call add_user_privacy and store the returned user_id in user_state.value
|
119 |
def toggle_oral_coach_visibility(class_name, index_no, policy_checked):
|
120 |
if not policy_checked:
|
121 |
return "Please agree to the Things to Note When using the Oral Coach ⚡ϞϞ(๑⚈ ․̫ ⚈๑)∩ ⚡ before submitting.", gr.update(visible=False)
|
@@ -174,7 +166,4 @@ with gr.Blocks(title="Oral Coach powered by ZeroGPU⚡ϞϞ(๑⚈ ․̫ ⚈๑)
|
|
174 |
create_teachers_dashboard_tab()
|
175 |
|
176 |
demo.queue(max_size=20)
|
177 |
-
demo.launch(
|
178 |
-
debug=True,
|
179 |
-
favicon_path="favicon.ico"
|
180 |
-
)
|
|
|
1 |
import gradio as gr
|
|
|
2 |
import os
|
3 |
import thinkingframes
|
4 |
import soundfile as sf
|
|
|
12 |
from database_functions import add_user_privacy, add_submission
|
13 |
from tab_teachers_dashboard import create_teachers_dashboard_tab
|
14 |
from config import CLASS_OPTIONS
|
|
|
15 |
import spaces
|
16 |
from streaming_stt_nemo import Model
|
17 |
import edge_tts
|
18 |
import tempfile
|
19 |
|
20 |
+
# Load environment variables
|
|
|
|
|
21 |
load_dotenv()
|
22 |
|
23 |
default_lang = "en"
|
|
|
32 |
image_path = "picturePerformance.jpg"
|
33 |
img_html = get_image_html(image_path)
|
34 |
|
|
|
|
|
35 |
@spaces.GPU(duration=120)
|
36 |
def transcribe(audio):
|
37 |
lang = "en"
|
|
|
52 |
"content": message
|
53 |
}]
|
54 |
|
|
|
55 |
feedback = llm(conversation)[0]["generated_text"]
|
56 |
|
57 |
questionNo = current_question_index + 1
|
|
|
108 |
logging.error(f"An error occurred: {str(e)}", exc_info=True)
|
109 |
return [("Oral Coach ⚡ϞϞ(๑⚈ ․̫ ⚈๑)∩ ⚡", "An error occurred. Please try again or seek assistance.")], current_audio_output
|
110 |
|
|
|
111 |
def toggle_oral_coach_visibility(class_name, index_no, policy_checked):
|
112 |
if not policy_checked:
|
113 |
return "Please agree to the Things to Note When using the Oral Coach ⚡ϞϞ(๑⚈ ․̫ ⚈๑)∩ ⚡ before submitting.", gr.update(visible=False)
|
|
|
166 |
create_teachers_dashboard_tab()
|
167 |
|
168 |
demo.queue(max_size=20)
|
169 |
+
demo.launch()
|
|
|
|
|
|