youssefga28 commited on
Commit
6c40867
·
verified ·
1 Parent(s): 712e64f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -52,7 +52,7 @@ def analyze_url(video_url):
52
  transcript = result["text"]
53
 
54
  # 4. LLM analysis
55
- api_key = "d2eac592fd335c7fd047814946f55e0c6fc26dbf75d88b0d9eb2be4a52108ea5"
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 & Confidence Analyzer") as demo:
83
- gr.Markdown("## 🎙️ English Accent Detection & Confidence Analysis")
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="LLM Confidence Analysis", lines=10)
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,