Update app.py
Browse files
app.py
CHANGED
|
@@ -52,7 +52,7 @@ def analyze_url(video_url):
|
|
| 52 |
transcript = result["text"]
|
| 53 |
|
| 54 |
# 4. LLM analysis
|
| 55 |
-
api_key =
|
| 56 |
client = Together(api_key=api_key)
|
| 57 |
prompt = f"""
|
| 58 |
You are an English-speaking coach. Given this transcript of a spoken English audio with an {accent} accent and classification confidence {conf_pct}%:
|
|
@@ -62,6 +62,7 @@ Evaluate how confident the speaker sounds based on fluency, clarity, filler usag
|
|
| 62 |
Provide:
|
| 63 |
- A proficiency score between 0 and 100
|
| 64 |
- A brief explanation
|
|
|
|
| 65 |
"""
|
| 66 |
resp = client.chat.completions.create(
|
| 67 |
model="meta-llama/Llama-3.3-70B-Instruct-Turbo-Free",
|
|
@@ -79,16 +80,16 @@ Provide:
|
|
| 79 |
return "Error", "", "", str(e)
|
| 80 |
|
| 81 |
# Build Gradio interface
|
| 82 |
-
with gr.Blocks(title="English Accent &
|
| 83 |
-
gr.Markdown("## 🎙️ English Accent Detection &
|
| 84 |
with gr.Row():
|
| 85 |
inp = gr.Textbox(label="Direct MP4 Video URL", placeholder="https://...")
|
| 86 |
run = gr.Button("Analyze")
|
| 87 |
with gr.Row():
|
| 88 |
out1 = gr.Textbox(label="Detected Accent")
|
| 89 |
-
out2 = gr.Textbox(label="Accent Confidence")
|
| 90 |
out3 = gr.Textbox(label="Transcript", lines=5)
|
| 91 |
-
out4 = gr.Textbox(label="
|
| 92 |
|
| 93 |
run.click(
|
| 94 |
fn=analyze_url,
|
|
|
|
| 52 |
transcript = result["text"]
|
| 53 |
|
| 54 |
# 4. LLM analysis
|
| 55 |
+
api_key = os.getenv('API_KEY')
|
| 56 |
client = Together(api_key=api_key)
|
| 57 |
prompt = f"""
|
| 58 |
You are an English-speaking coach. Given this transcript of a spoken English audio with an {accent} accent and classification confidence {conf_pct}%:
|
|
|
|
| 62 |
Provide:
|
| 63 |
- A proficiency score between 0 and 100
|
| 64 |
- A brief explanation
|
| 65 |
+
- Don't Write Anything in Bold
|
| 66 |
"""
|
| 67 |
resp = client.chat.completions.create(
|
| 68 |
model="meta-llama/Llama-3.3-70B-Instruct-Turbo-Free",
|
|
|
|
| 80 |
return "Error", "", "", str(e)
|
| 81 |
|
| 82 |
# Build Gradio interface
|
| 83 |
+
with gr.Blocks(title="English Accent & Proficiency Analyzer") as demo:
|
| 84 |
+
gr.Markdown("## 🎙️ English Accent Detection & Proficiency Analysis")
|
| 85 |
with gr.Row():
|
| 86 |
inp = gr.Textbox(label="Direct MP4 Video URL", placeholder="https://...")
|
| 87 |
run = gr.Button("Analyze")
|
| 88 |
with gr.Row():
|
| 89 |
out1 = gr.Textbox(label="Detected Accent")
|
| 90 |
+
out2 = gr.Textbox(label="Accent Classification Confidence Score")
|
| 91 |
out3 = gr.Textbox(label="Transcript", lines=5)
|
| 92 |
+
out4 = gr.Textbox(label="Proficiency Analysis", lines=10)
|
| 93 |
|
| 94 |
run.click(
|
| 95 |
fn=analyze_url,
|