Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- .gitignore +3 -0
- .gradio/flagged/dataset1.csv +6 -0
- README.md +2 -8
- Summarizer_Agent.py +64 -0
- app.py +50 -0
- audio.mp3 +3 -0
- classifier_modal.py +55 -0
- modal.deploy.ipynb +149 -0
- pyproject.toml +48 -0
- requirements.txt +4 -0
- summarize_agent.ipynb +352 -0
- uv.lock +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
audio.mp3 filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.env
|
| 2 |
+
__pycache__/
|
| 3 |
+
.venv/
|
.gradio/flagged/dataset1.csv
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
YouTube URL,Candidate Summary,Detected Accent,Confidence Score,timestamp
|
| 2 |
+
https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/data/malaysia_1.wav,"Summary: The candidate conveyed that performing a random act of kindness does not require one to be wealthy, physically fit, popular, or possess any special attributes.
|
| 3 |
+
|
| 4 |
+
Motivation and Key Skills: The candidate demonstrates empathy, inclusiveness, and a positive attitude toward kindness. This reflects emotional intelligence and a value-driven mindset.
|
| 5 |
+
|
| 6 |
+
Additional Insights: The candidateโs statement suggests they prioritize kindness and accessibility in actions, indicating potential strengths in teamwork, interpersonal relations, and company culture fit focused on compassion and humility.",['malaysia'],tensor([1.0000]),2025-06-07 20:12:45.387168
|
README.md
CHANGED
|
@@ -1,12 +1,6 @@
|
|
| 1 |
---
|
| 2 |
title: AccentDetector
|
| 3 |
-
emoji: ๐
|
| 4 |
-
colorFrom: purple
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 5.33.0
|
| 8 |
app_file: app.py
|
| 9 |
-
|
|
|
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
title: AccentDetector
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
app_file: app.py
|
| 4 |
+
sdk: gradio
|
| 5 |
+
sdk_version: 5.25.0
|
| 6 |
---
|
|
|
|
|
|
Summarizer_Agent.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from openai import OpenAI
|
| 2 |
+
# from dotenv import load_dotenv
|
| 3 |
+
import yt_dlp
|
| 4 |
+
import modal
|
| 5 |
+
import torch
|
| 6 |
+
|
| 7 |
+
class Summarizer:
|
| 8 |
+
def __init__(self):
|
| 9 |
+
self.system='''You are an intelligent assistant working for a company that builds advanced tools to automate real hiring decisions. Your task is to analyze speech-to-text transcripts from candidate interviews. For each candidateโs response, you will:
|
| 10 |
+
|
| 11 |
+
Provide a clear and concise summary of what the candidate said.
|
| 12 |
+
|
| 13 |
+
Identify the candidateโs motivation and key skills expressed in their speech.
|
| 14 |
+
|
| 15 |
+
Highlight any additional insights or relevant observations that could assist recruiters in making informed hiring decisions.
|
| 16 |
+
|
| 17 |
+
Focus on delivering objective, actionable, and relevant information that captures the candidateโs potential skills'''
|
| 18 |
+
|
| 19 |
+
self.transcriber="gpt-4o-transcribe"
|
| 20 |
+
self.summarizer="gpt-4.1-mini"
|
| 21 |
+
self.Accentizer= modal.Cls.lookup("ClassifierAudio", "Accentizer")
|
| 22 |
+
self.client=OpenAI()
|
| 23 |
+
def download_audio(self,url, output_path='audio'):
|
| 24 |
+
import yt_dlp
|
| 25 |
+
ydl_opts = {
|
| 26 |
+
'format': 'bestaudio/best',
|
| 27 |
+
'outtmpl': output_path,
|
| 28 |
+
'postprocessors': [{
|
| 29 |
+
'key': 'FFmpegExtractAudio',
|
| 30 |
+
'preferredcodec': 'mp3', # or 'wav'
|
| 31 |
+
'preferredquality': '192',
|
| 32 |
+
}],
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 36 |
+
ydl.download([url])
|
| 37 |
+
def classify(self,url):
|
| 38 |
+
raw= self.Accentizer.classify.remote(url)
|
| 39 |
+
accent = raw["label"][0] if isinstance(raw["label"], list) else str(raw["label"])
|
| 40 |
+
score = raw["score"].item() if isinstance(raw["score"], torch.Tensor) else float(raw["score"])
|
| 41 |
+
return {
|
| 42 |
+
"label": accent,
|
| 43 |
+
"score": round(score, 4)
|
| 44 |
+
}
|
| 45 |
+
return result
|
| 46 |
+
def summarize(self,url):
|
| 47 |
+
self.download_audio(url=url)
|
| 48 |
+
audio_file=open("./audio.mp3", "rb")
|
| 49 |
+
transcription = self.client.audio.transcriptions.create(
|
| 50 |
+
model=self.transcriber,
|
| 51 |
+
file=audio_file
|
| 52 |
+
)
|
| 53 |
+
user_prompt="Here is transcription of the audio \n "
|
| 54 |
+
user_prompt+=transcription.text
|
| 55 |
+
prompts = [
|
| 56 |
+
{"role": "system", "content": self.system},
|
| 57 |
+
{"role": "user", "content": user_prompt}
|
| 58 |
+
]
|
| 59 |
+
chat=self.client.chat.completions.create(
|
| 60 |
+
model=self.summarizer,
|
| 61 |
+
messages=prompts
|
| 62 |
+
)
|
| 63 |
+
return chat.choices[0].message.content
|
| 64 |
+
|
app.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from Summarizer_Agent import Summarizer
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
summarizer=Summarizer()
|
| 5 |
+
flags = {
|
| 6 |
+
"us": "๐บ๐ธ",
|
| 7 |
+
"england": "๐ด",
|
| 8 |
+
"australia": "๐ฆ๐บ",
|
| 9 |
+
"indian": "๐ฎ๐ณ",
|
| 10 |
+
"canada": "๐จ๐ฆ",
|
| 11 |
+
"bermuda": "๐ง๐ฒ",
|
| 12 |
+
"scotland": "๐ด",
|
| 13 |
+
"african": "๐",
|
| 14 |
+
"ireland": "๐ฎ๐ช",
|
| 15 |
+
"newzealand": "๐ณ๐ฟ",
|
| 16 |
+
"wales": "๐ด",
|
| 17 |
+
"malaysia": "๐ฒ๐พ",
|
| 18 |
+
"philippines": "๐ต๐ญ",
|
| 19 |
+
"singapore": "๐ธ๐ฌ",
|
| 20 |
+
"hongkong": "๐ญ๐ฐ",
|
| 21 |
+
"southatlandtic": "๐"
|
| 22 |
+
}
|
| 23 |
+
def process_youtube(url):
|
| 24 |
+
try:
|
| 25 |
+
summary = summarizer.summarize(url)
|
| 26 |
+
accent_info = summarizer.classify(url)
|
| 27 |
+
|
| 28 |
+
accent = accent_info["label"]
|
| 29 |
+
flag = flags.get(accent.lower(), "๐ณ๏ธ") # fallback to white flag if not found
|
| 30 |
+
accent_display = f"{flag} {accent.capitalize()}"
|
| 31 |
+
|
| 32 |
+
return summary, accent_display, accent_info["score"]
|
| 33 |
+
except Exception as e:
|
| 34 |
+
return f"Error: {e}"
|
| 35 |
+
|
| 36 |
+
demo = gr.Interface(
|
| 37 |
+
fn=process_youtube,
|
| 38 |
+
inputs=gr.Textbox(label="public video URL", placeholder="Enter public video link here..."),
|
| 39 |
+
outputs=[
|
| 40 |
+
gr.Textbox(label="Candidate Summary", lines=10),
|
| 41 |
+
gr.Textbox(label="Detected Accent"),
|
| 42 |
+
gr.Slider(label="Confidence Score (%)", minimum=0, maximum=1, step=0.001, interactive=False)
|
| 43 |
+
|
| 44 |
+
],
|
| 45 |
+
title="Interview Audio Summarizer",
|
| 46 |
+
description="Paste an interview video link. The app will summarize the candidate's response and detect the speaker's accent."
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
if __name__=="__main__":
|
| 50 |
+
demo.launch()
|
audio.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:09f5ca56abe7aad574432153bac21f6d2ecfba09f5a5f0c1cbe104a02e5ac778
|
| 3 |
+
size 149084
|
classifier_modal.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import modal
|
| 2 |
+
from modal import App,Image
|
| 3 |
+
|
| 4 |
+
app=modal.App(name="ClassifierAudio")
|
| 5 |
+
image = Image.debian_slim().pip_install("torch","huggingface","transformers","speechbrain","numpy","torchaudio","yt_dlp").apt_install("ffmpeg")
|
| 6 |
+
model_name = "warisqr7/accent-id-commonaccent_xlsr-en-english"
|
| 7 |
+
secrets = [modal.Secret.from_name("hf-secret")]
|
| 8 |
+
LOCAL_DIR="model"
|
| 9 |
+
@app.cls(image=image, secrets=secrets, timeout=1800)
|
| 10 |
+
|
| 11 |
+
class Accentizer:
|
| 12 |
+
@modal.build()
|
| 13 |
+
def download_model(self):
|
| 14 |
+
from huggingface_hub import snapshot_download
|
| 15 |
+
import os
|
| 16 |
+
import torch
|
| 17 |
+
BASE_DIR="model"
|
| 18 |
+
os.makedirs(BASE_DIR, exist_ok=True)
|
| 19 |
+
snapshot_download(model_name, local_dir=LOCAL_DIR)
|
| 20 |
+
@modal.enter()
|
| 21 |
+
def setup(self):
|
| 22 |
+
import yt_dlp
|
| 23 |
+
from speechbrain.pretrained.interfaces import foreign_class
|
| 24 |
+
self.download=self.download_audio
|
| 25 |
+
self.classifier = foreign_class(source=LOCAL_DIR, pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")
|
| 26 |
+
|
| 27 |
+
def download_audio(self,url, output_path='audio'):
|
| 28 |
+
import yt_dlp
|
| 29 |
+
ydl_opts = {
|
| 30 |
+
'format': 'bestaudio/best',
|
| 31 |
+
'outtmpl': output_path,
|
| 32 |
+
'postprocessors': [{
|
| 33 |
+
'key': 'FFmpegExtractAudio',
|
| 34 |
+
'preferredcodec': 'mp3', # or 'wav'
|
| 35 |
+
'preferredquality': '192',
|
| 36 |
+
}],
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 40 |
+
ydl.download([url])
|
| 41 |
+
@modal.method()
|
| 42 |
+
def classify(self, url):
|
| 43 |
+
import torch
|
| 44 |
+
import torchaudio
|
| 45 |
+
import yt_dlp
|
| 46 |
+
|
| 47 |
+
self.download(url)
|
| 48 |
+
|
| 49 |
+
audio_path = "audio.mp3"
|
| 50 |
+
|
| 51 |
+
out_prob, score, index, text_lab = self.classifier.classify_file(audio_path)
|
| 52 |
+
return {"label": text_lab, "score": score, "index": index, "out_prob": out_prob}
|
| 53 |
+
@modal.method()
|
| 54 |
+
def wake_up(self) -> str:
|
| 55 |
+
return "ok"
|
modal.deploy.ipynb
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 46,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [
|
| 8 |
+
{
|
| 9 |
+
"name": "stdout",
|
| 10 |
+
"output_type": "stream",
|
| 11 |
+
"text": [
|
| 12 |
+
"โโ Modal Deprecation Warning (2025-02-06) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n",
|
| 13 |
+
"โ Using Python module paths will require using the -m flag in a future โ\n",
|
| 14 |
+
"โ version of Modal. โ\n",
|
| 15 |
+
"โ Use `modal deploy -m classifier_modal` instead. โ\n",
|
| 16 |
+
"โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n",
|
| 17 |
+
"โโ Modal Deprecation Warning (2025-01-15) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n",
|
| 18 |
+
"โ The `@modal.build` decorator is deprecated and will be removed in a future โ\n",
|
| 19 |
+
"โ release. โ\n",
|
| 20 |
+
"โ โ\n",
|
| 21 |
+
"โ We now recommend storing large assets (such as model weights) using a โ\n",
|
| 22 |
+
"โ `modal.Volume` instead of writing them directly into the `modal.Image` โ\n",
|
| 23 |
+
"โ filesystem. For other use cases we recommend using `Image.run_function` โ\n",
|
| 24 |
+
"โ instead. โ\n",
|
| 25 |
+
"โ โ\n",
|
| 26 |
+
"โ See https://modal.com/docs/guide/modal-1-0-migration for more information. โ\n",
|
| 27 |
+
"โ โ\n",
|
| 28 |
+
"โ Source: c:\\LLM\\AccentDetector\\classifier_modal.py:12 โ\n",
|
| 29 |
+
"โ @modal.build() โ\n",
|
| 30 |
+
"โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n",
|
| 31 |
+
"- Creating objects...\n",
|
| 32 |
+
"\\ Creating objects...\n",
|
| 33 |
+
"โโโ - Creating mount c:\\LLM\\AccentDetector\\classifier_modal.py: Uploaded 0/1 \n",
|
| 34 |
+
" files\n",
|
| 35 |
+
"/ Creating objects...\n",
|
| 36 |
+
"โโโ | Creating mount c:\\LLM\\AccentDetector\\classifier_modal.py: Uploaded 0/1 \n",
|
| 37 |
+
" files\n",
|
| 38 |
+
"\\ Creating objects...\n",
|
| 39 |
+
"โโโ / Creating mount c:\\LLM\\AccentDetector\\classifier_modal.py: Uploaded 0/1 \n",
|
| 40 |
+
" files\n",
|
| 41 |
+
"/ Creating objects...\n",
|
| 42 |
+
"โโโ \\ Creating mount c:\\LLM\\AccentDetector\\classifier_modal.py: Finalizing \n",
|
| 43 |
+
" index of 1 files\n",
|
| 44 |
+
"\\ Creating objects...\n",
|
| 45 |
+
"โโโ ๐จ Created mount c:\\LLM\\AccentDetector\\classifier_modal.py\n",
|
| 46 |
+
"โโโ ๐จ Created function Accentizer.download_model.\n",
|
| 47 |
+
"/ Creating objects...\n",
|
| 48 |
+
"โโโ ๐จ Created mount c:\\LLM\\AccentDetector\\classifier_modal.py\n",
|
| 49 |
+
"โโโ ๐จ Created function Accentizer.download_model.\n",
|
| 50 |
+
"โโโ - Creating function Accentizer.*...\n",
|
| 51 |
+
"\\ Creating objects...\n",
|
| 52 |
+
"โโโ ๐จ Created mount c:\\LLM\\AccentDetector\\classifier_modal.py\n",
|
| 53 |
+
"โโโ ๐จ Created function Accentizer.download_model.\n",
|
| 54 |
+
"โโโ ๐จ Created function Accentizer.*.\n",
|
| 55 |
+
"\\ Creating objects...\n",
|
| 56 |
+
"โโโ ๐จ Created mount c:\\LLM\\AccentDetector\\classifier_modal.py\n",
|
| 57 |
+
"โโโ ๐จ Created function Accentizer.download_model.\n",
|
| 58 |
+
"โโโ ๐จ Created function Accentizer.*.\n",
|
| 59 |
+
"\n",
|
| 60 |
+
"โ Created objects.\n",
|
| 61 |
+
"โโโ ๐จ Created mount c:\\LLM\\AccentDetector\\classifier_modal.py\n",
|
| 62 |
+
"โโโ ๐จ Created function Accentizer.download_model.\n",
|
| 63 |
+
"โโโ ๐จ Created function Accentizer.*.\n",
|
| 64 |
+
"โ App deployed in 2.520s! ๐\n",
|
| 65 |
+
"\n",
|
| 66 |
+
"View Deployment: \n",
|
| 67 |
+
"https://modal.com/apps/djallelbrahmia/main/deployed/ClassifierAudio\n"
|
| 68 |
+
]
|
| 69 |
+
}
|
| 70 |
+
],
|
| 71 |
+
"source": [
|
| 72 |
+
"!modal deploy classifier_modal"
|
| 73 |
+
]
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"cell_type": "code",
|
| 77 |
+
"execution_count": 44,
|
| 78 |
+
"metadata": {},
|
| 79 |
+
"outputs": [
|
| 80 |
+
{
|
| 81 |
+
"name": "stderr",
|
| 82 |
+
"output_type": "stream",
|
| 83 |
+
"text": [
|
| 84 |
+
"C:\\Python312\\Lib\\asyncio\\events.py:88: DeprecationError: 2025-01-27: `modal.Cls.lookup` is deprecated and will be removed in a future release. It can be replaced with `modal.Cls.from_name`.\n",
|
| 85 |
+
"\n",
|
| 86 |
+
"See https://modal.com/docs/guide/modal-1-0-migration for more information.\n",
|
| 87 |
+
" self._context.run(self._callback, *self._args)\n",
|
| 88 |
+
"C:\\Users\\dbrah\\AppData\\Local\\Temp\\ipykernel_62300\\1972719297.py:5: DeprecationError: 2025-01-13: Calling a method on an uninstantiated class will soon be deprecated; update your code to instantiate the class first, i.e.:\n",
|
| 89 |
+
"Accentizer().classify instead of Accentizer.classify\n",
|
| 90 |
+
" result=Accentizer.classify.remote(link)\n"
|
| 91 |
+
]
|
| 92 |
+
}
|
| 93 |
+
],
|
| 94 |
+
"source": [
|
| 95 |
+
"import modal\n",
|
| 96 |
+
"import torch\n",
|
| 97 |
+
"link=\"https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/data/malaysia_1.wav\"\n",
|
| 98 |
+
"Accentizer = modal.Cls.lookup(\"ClassifierAudio\", \"Accentizer\")\n",
|
| 99 |
+
"result=Accentizer.classify.remote(link)"
|
| 100 |
+
]
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"cell_type": "code",
|
| 104 |
+
"execution_count": 45,
|
| 105 |
+
"metadata": {},
|
| 106 |
+
"outputs": [
|
| 107 |
+
{
|
| 108 |
+
"data": {
|
| 109 |
+
"text/plain": [
|
| 110 |
+
"{'label': ['malaysia'],\n",
|
| 111 |
+
" 'score': tensor([1.0000]),\n",
|
| 112 |
+
" 'index': tensor([11]),\n",
|
| 113 |
+
" 'out_prob': tensor([[1.1861e-06, 1.2054e-10, 5.3472e-11, 5.4380e-13, 2.0032e-15, 4.4907e-07,\n",
|
| 114 |
+
" 6.3840e-15, 4.1447e-15, 6.7380e-18, 1.5645e-16, 2.8600e-14, 1.0000e+00,\n",
|
| 115 |
+
" 9.1363e-11, 1.0672e-14, 2.5263e-11, 2.2510e-09]])}"
|
| 116 |
+
]
|
| 117 |
+
},
|
| 118 |
+
"execution_count": 45,
|
| 119 |
+
"metadata": {},
|
| 120 |
+
"output_type": "execute_result"
|
| 121 |
+
}
|
| 122 |
+
],
|
| 123 |
+
"source": [
|
| 124 |
+
"result"
|
| 125 |
+
]
|
| 126 |
+
}
|
| 127 |
+
],
|
| 128 |
+
"metadata": {
|
| 129 |
+
"kernelspec": {
|
| 130 |
+
"display_name": ".venv",
|
| 131 |
+
"language": "python",
|
| 132 |
+
"name": "python3"
|
| 133 |
+
},
|
| 134 |
+
"language_info": {
|
| 135 |
+
"codemirror_mode": {
|
| 136 |
+
"name": "ipython",
|
| 137 |
+
"version": 3
|
| 138 |
+
},
|
| 139 |
+
"file_extension": ".py",
|
| 140 |
+
"mimetype": "text/x-python",
|
| 141 |
+
"name": "python",
|
| 142 |
+
"nbconvert_exporter": "python",
|
| 143 |
+
"pygments_lexer": "ipython3",
|
| 144 |
+
"version": "3.12.6"
|
| 145 |
+
}
|
| 146 |
+
},
|
| 147 |
+
"nbformat": 4,
|
| 148 |
+
"nbformat_minor": 2
|
| 149 |
+
}
|
pyproject.toml
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "agents"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "Add your description here"
|
| 5 |
+
readme = "README.md"
|
| 6 |
+
requires-python = ">=3.12"
|
| 7 |
+
dependencies = [
|
| 8 |
+
"anthropic>=0.49.0",
|
| 9 |
+
"autogen-agentchat>=0.4.9.2",
|
| 10 |
+
"autogen-ext[grpc,mcp,ollama,openai]>=0.4.9.2",
|
| 11 |
+
"bs4>=0.0.2",
|
| 12 |
+
"google-genai>=1.14.0",
|
| 13 |
+
"gradio>=5.22.0",
|
| 14 |
+
"httpx>=0.28.1",
|
| 15 |
+
"ipywidgets>=8.1.5",
|
| 16 |
+
"langchain-anthropic>=0.3.10",
|
| 17 |
+
"langchain-community>=0.3.20",
|
| 18 |
+
"langchain-experimental>=0.3.4",
|
| 19 |
+
"langchain-openai>=0.3.9",
|
| 20 |
+
"langgraph>=0.3.18",
|
| 21 |
+
"langgraph-checkpoint-sqlite>=2.0.6",
|
| 22 |
+
"langsmith>=0.3.18",
|
| 23 |
+
"lxml>=5.3.1",
|
| 24 |
+
"mcp-server-fetch>=2025.1.17",
|
| 25 |
+
"mcp[cli]>=1.5.0",
|
| 26 |
+
"openai>=1.68.2",
|
| 27 |
+
"openai-agents>=0.0.6",
|
| 28 |
+
"playwright>=1.51.0",
|
| 29 |
+
"plotly>=6.0.1",
|
| 30 |
+
"polygon-api-client>=1.14.5",
|
| 31 |
+
"psutil>=7.0.0",
|
| 32 |
+
"pypdf>=5.4.0",
|
| 33 |
+
"pypdf2>=3.0.1",
|
| 34 |
+
"python-dotenv>=1.0.1",
|
| 35 |
+
"python-hue-v2>=2.2.1",
|
| 36 |
+
"requests>=2.32.3",
|
| 37 |
+
"semantic-kernel>=1.25.0",
|
| 38 |
+
"sendgrid>=6.11.0",
|
| 39 |
+
"setuptools>=78.1.0",
|
| 40 |
+
"smithery>=0.1.0",
|
| 41 |
+
"speedtest-cli>=2.1.3",
|
| 42 |
+
"wikipedia>=1.4.0",
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
[dependency-groups]
|
| 46 |
+
dev = [
|
| 47 |
+
"ipykernel>=6.29.5",
|
| 48 |
+
]
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
openai
|
| 2 |
+
yt_dlp
|
| 3 |
+
modal
|
| 4 |
+
torch
|
summarize_agent.ipynb
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 3,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [
|
| 8 |
+
{
|
| 9 |
+
"ename": "KeyboardInterrupt",
|
| 10 |
+
"evalue": "",
|
| 11 |
+
"output_type": "error",
|
| 12 |
+
"traceback": [
|
| 13 |
+
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
|
| 14 |
+
"\u001b[31mKeyboardInterrupt\u001b[39m Traceback (most recent call last)",
|
| 15 |
+
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[3]\u001b[39m\u001b[32m, line 7\u001b[39m\n\u001b[32m 4\u001b[39m client = OpenAI()\n\u001b[32m 5\u001b[39m audio_file= \u001b[38;5;28mopen\u001b[39m(\u001b[33m\"\u001b[39m\u001b[33m./audio.wav\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mrb\u001b[39m\u001b[33m\"\u001b[39m)\n\u001b[32m----> \u001b[39m\u001b[32m7\u001b[39m transcription = \u001b[43mclient\u001b[49m\u001b[43m.\u001b[49m\u001b[43maudio\u001b[49m\u001b[43m.\u001b[49m\u001b[43mtranscriptions\u001b[49m\u001b[43m.\u001b[49m\u001b[43mcreate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 8\u001b[39m \u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m=\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mgpt-4o-transcribe\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[32m 9\u001b[39m \u001b[43m \u001b[49m\u001b[43mfile\u001b[49m\u001b[43m=\u001b[49m\u001b[43maudio_file\u001b[49m\n\u001b[32m 10\u001b[39m \u001b[43m)\u001b[49m\n\u001b[32m 12\u001b[39m \u001b[38;5;28mprint\u001b[39m(transcription.text)\n",
|
| 16 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\openai\\_utils\\_utils.py:287\u001b[39m, in \u001b[36mrequired_args.<locals>.inner.<locals>.wrapper\u001b[39m\u001b[34m(*args, **kwargs)\u001b[39m\n\u001b[32m 285\u001b[39m msg = \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mMissing required argument: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mquote(missing[\u001b[32m0\u001b[39m])\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m\n\u001b[32m 286\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(msg)\n\u001b[32m--> \u001b[39m\u001b[32m287\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[43m*\u001b[49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 17 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\openai\\resources\\audio\\transcriptions.py:333\u001b[39m, in \u001b[36mTranscriptions.create\u001b[39m\u001b[34m(self, file, model, chunking_strategy, include, language, prompt, response_format, stream, temperature, timestamp_granularities, extra_headers, extra_query, extra_body, timeout)\u001b[39m\n\u001b[32m 329\u001b[39m \u001b[38;5;66;03m# It should be noted that the actual Content-Type header that will be\u001b[39;00m\n\u001b[32m 330\u001b[39m \u001b[38;5;66;03m# sent to the server will contain a `boundary` parameter, e.g.\u001b[39;00m\n\u001b[32m 331\u001b[39m \u001b[38;5;66;03m# multipart/form-data; boundary=---abc--\u001b[39;00m\n\u001b[32m 332\u001b[39m extra_headers = {\u001b[33m\"\u001b[39m\u001b[33mContent-Type\u001b[39m\u001b[33m\"\u001b[39m: \u001b[33m\"\u001b[39m\u001b[33mmultipart/form-data\u001b[39m\u001b[33m\"\u001b[39m, **(extra_headers \u001b[38;5;129;01mor\u001b[39;00m {})}\n\u001b[32m--> \u001b[39m\u001b[32m333\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_post\u001b[49m\u001b[43m(\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore[return-value]\u001b[39;49;00m\n\u001b[32m 334\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43m/audio/transcriptions\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 335\u001b[39m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmaybe_transform\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 336\u001b[39m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 337\u001b[39m \u001b[43m \u001b[49m\u001b[43mtranscription_create_params\u001b[49m\u001b[43m.\u001b[49m\u001b[43mTranscriptionCreateParamsStreaming\u001b[49m\n\u001b[32m 338\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\n\u001b[32m 339\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mtranscription_create_params\u001b[49m\u001b[43m.\u001b[49m\u001b[43mTranscriptionCreateParamsNonStreaming\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 340\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 341\u001b[39m \u001b[43m \u001b[49m\u001b[43mfiles\u001b[49m\u001b[43m=\u001b[49m\u001b[43mfiles\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 342\u001b[39m \u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmake_request_options\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 343\u001b[39m \u001b[43m \u001b[49m\u001b[43mextra_headers\u001b[49m\u001b[43m=\u001b[49m\u001b[43mextra_headers\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mextra_query\u001b[49m\u001b[43m=\u001b[49m\u001b[43mextra_query\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mextra_body\u001b[49m\u001b[43m=\u001b[49m\u001b[43mextra_body\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout\u001b[49m\n\u001b[32m 344\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 345\u001b[39m \u001b[43m \u001b[49m\u001b[43mcast_to\u001b[49m\u001b[43m=\u001b[49m\u001b[43m_get_response_format_type\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresponse_format\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 346\u001b[39m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 347\u001b[39m \u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[43m=\u001b[49m\u001b[43mStream\u001b[49m\u001b[43m[\u001b[49m\u001b[43mTranscriptionStreamEvent\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 348\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 18 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\openai\\_base_client.py:1242\u001b[39m, in \u001b[36mSyncAPIClient.post\u001b[39m\u001b[34m(self, path, cast_to, body, options, files, stream, stream_cls)\u001b[39m\n\u001b[32m 1228\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mpost\u001b[39m(\n\u001b[32m 1229\u001b[39m \u001b[38;5;28mself\u001b[39m,\n\u001b[32m 1230\u001b[39m path: \u001b[38;5;28mstr\u001b[39m,\n\u001b[32m (...)\u001b[39m\u001b[32m 1237\u001b[39m stream_cls: \u001b[38;5;28mtype\u001b[39m[_StreamT] | \u001b[38;5;28;01mNone\u001b[39;00m = \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[32m 1238\u001b[39m ) -> ResponseT | _StreamT:\n\u001b[32m 1239\u001b[39m opts = FinalRequestOptions.construct(\n\u001b[32m 1240\u001b[39m method=\u001b[33m\"\u001b[39m\u001b[33mpost\u001b[39m\u001b[33m\"\u001b[39m, url=path, json_data=body, files=to_httpx_files(files), **options\n\u001b[32m 1241\u001b[39m )\n\u001b[32m-> \u001b[39m\u001b[32m1242\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m cast(ResponseT, \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mopts\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[43m)\u001b[49m)\n",
|
| 19 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\openai\\_base_client.py:972\u001b[39m, in \u001b[36mSyncAPIClient.request\u001b[39m\u001b[34m(self, cast_to, options, stream, stream_cls)\u001b[39m\n\u001b[32m 970\u001b[39m response = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 971\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m972\u001b[39m response = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_client\u001b[49m\u001b[43m.\u001b[49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 973\u001b[39m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 974\u001b[39m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_should_stream_response_body\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 975\u001b[39m \u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 976\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 977\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m httpx.TimeoutException \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[32m 978\u001b[39m log.debug(\u001b[33m\"\u001b[39m\u001b[33mEncountered httpx.TimeoutException\u001b[39m\u001b[33m\"\u001b[39m, exc_info=\u001b[38;5;28;01mTrue\u001b[39;00m)\n",
|
| 20 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpx\\_client.py:914\u001b[39m, in \u001b[36mClient.send\u001b[39m\u001b[34m(self, request, stream, auth, follow_redirects)\u001b[39m\n\u001b[32m 910\u001b[39m \u001b[38;5;28mself\u001b[39m._set_timeout(request)\n\u001b[32m 912\u001b[39m auth = \u001b[38;5;28mself\u001b[39m._build_request_auth(request, auth)\n\u001b[32m--> \u001b[39m\u001b[32m914\u001b[39m response = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_send_handling_auth\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 915\u001b[39m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 916\u001b[39m \u001b[43m \u001b[49m\u001b[43mauth\u001b[49m\u001b[43m=\u001b[49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 917\u001b[39m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m=\u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 918\u001b[39m \u001b[43m \u001b[49m\u001b[43mhistory\u001b[49m\u001b[43m=\u001b[49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 919\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 920\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 921\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m stream:\n",
|
| 21 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpx\\_client.py:942\u001b[39m, in \u001b[36mClient._send_handling_auth\u001b[39m\u001b[34m(self, request, auth, follow_redirects, history)\u001b[39m\n\u001b[32m 939\u001b[39m request = \u001b[38;5;28mnext\u001b[39m(auth_flow)\n\u001b[32m 941\u001b[39m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m942\u001b[39m response = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_send_handling_redirects\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 943\u001b[39m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 944\u001b[39m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m=\u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 945\u001b[39m \u001b[43m \u001b[49m\u001b[43mhistory\u001b[49m\u001b[43m=\u001b[49m\u001b[43mhistory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 946\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 947\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 948\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
|
| 22 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpx\\_client.py:979\u001b[39m, in \u001b[36mClient._send_handling_redirects\u001b[39m\u001b[34m(self, request, follow_redirects, history)\u001b[39m\n\u001b[32m 976\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m hook \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m._event_hooks[\u001b[33m\"\u001b[39m\u001b[33mrequest\u001b[39m\u001b[33m\"\u001b[39m]:\n\u001b[32m 977\u001b[39m hook(request)\n\u001b[32m--> \u001b[39m\u001b[32m979\u001b[39m response = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_send_single_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 980\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 981\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m hook \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m._event_hooks[\u001b[33m\"\u001b[39m\u001b[33mresponse\u001b[39m\u001b[33m\"\u001b[39m]:\n",
|
| 23 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpx\\_client.py:1014\u001b[39m, in \u001b[36mClient._send_single_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 1009\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[32m 1010\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mAttempted to send an async request with a sync Client instance.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 1011\u001b[39m )\n\u001b[32m 1013\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m request_context(request=request):\n\u001b[32m-> \u001b[39m\u001b[32m1014\u001b[39m response = \u001b[43mtransport\u001b[49m\u001b[43m.\u001b[49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1016\u001b[39m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(response.stream, SyncByteStream)\n\u001b[32m 1018\u001b[39m response.request = request\n",
|
| 24 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpx\\_transports\\default.py:250\u001b[39m, in \u001b[36mHTTPTransport.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 237\u001b[39m req = httpcore.Request(\n\u001b[32m 238\u001b[39m method=request.method,\n\u001b[32m 239\u001b[39m url=httpcore.URL(\n\u001b[32m (...)\u001b[39m\u001b[32m 247\u001b[39m extensions=request.extensions,\n\u001b[32m 248\u001b[39m )\n\u001b[32m 249\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m map_httpcore_exceptions():\n\u001b[32m--> \u001b[39m\u001b[32m250\u001b[39m resp = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_pool\u001b[49m\u001b[43m.\u001b[49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 252\u001b[39m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(resp.stream, typing.Iterable)\n\u001b[32m 254\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m Response(\n\u001b[32m 255\u001b[39m status_code=resp.status,\n\u001b[32m 256\u001b[39m headers=resp.headers,\n\u001b[32m 257\u001b[39m stream=ResponseStream(resp.stream),\n\u001b[32m 258\u001b[39m extensions=resp.extensions,\n\u001b[32m 259\u001b[39m )\n",
|
| 25 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpcore\\_sync\\connection_pool.py:256\u001b[39m, in \u001b[36mConnectionPool.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 253\u001b[39m closing = \u001b[38;5;28mself\u001b[39m._assign_requests_to_connections()\n\u001b[32m 255\u001b[39m \u001b[38;5;28mself\u001b[39m._close_connections(closing)\n\u001b[32m--> \u001b[39m\u001b[32m256\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m exc \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 258\u001b[39m \u001b[38;5;66;03m# Return the response. Note that in this case we still have to manage\u001b[39;00m\n\u001b[32m 259\u001b[39m \u001b[38;5;66;03m# the point at which the response is closed.\u001b[39;00m\n\u001b[32m 260\u001b[39m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(response.stream, typing.Iterable)\n",
|
| 26 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpcore\\_sync\\connection_pool.py:236\u001b[39m, in \u001b[36mConnectionPool.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 232\u001b[39m connection = pool_request.wait_for_connection(timeout=timeout)\n\u001b[32m 234\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 235\u001b[39m \u001b[38;5;66;03m# Send the request on the assigned connection.\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m236\u001b[39m response = \u001b[43mconnection\u001b[49m\u001b[43m.\u001b[49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 237\u001b[39m \u001b[43m \u001b[49m\u001b[43mpool_request\u001b[49m\u001b[43m.\u001b[49m\u001b[43mrequest\u001b[49m\n\u001b[32m 238\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 239\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m ConnectionNotAvailable:\n\u001b[32m 240\u001b[39m \u001b[38;5;66;03m# In some cases a connection may initially be available to\u001b[39;00m\n\u001b[32m 241\u001b[39m \u001b[38;5;66;03m# handle a request, but then become unavailable.\u001b[39;00m\n\u001b[32m 242\u001b[39m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[32m 243\u001b[39m \u001b[38;5;66;03m# In this case we clear the connection and try again.\u001b[39;00m\n\u001b[32m 244\u001b[39m pool_request.clear_connection()\n",
|
| 27 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpcore\\_sync\\connection.py:103\u001b[39m, in \u001b[36mHTTPConnection.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 100\u001b[39m \u001b[38;5;28mself\u001b[39m._connect_failed = \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[32m 101\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m exc\n\u001b[32m--> \u001b[39m\u001b[32m103\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_connection\u001b[49m\u001b[43m.\u001b[49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 28 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpcore\\_sync\\http11.py:136\u001b[39m, in \u001b[36mHTTP11Connection.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 134\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m Trace(\u001b[33m\"\u001b[39m\u001b[33mresponse_closed\u001b[39m\u001b[33m\"\u001b[39m, logger, request) \u001b[38;5;28;01mas\u001b[39;00m trace:\n\u001b[32m 135\u001b[39m \u001b[38;5;28mself\u001b[39m._response_closed()\n\u001b[32m--> \u001b[39m\u001b[32m136\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m exc\n",
|
| 29 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpcore\\_sync\\http11.py:106\u001b[39m, in \u001b[36mHTTP11Connection.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 95\u001b[39m \u001b[38;5;28;01mpass\u001b[39;00m\n\u001b[32m 97\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m Trace(\n\u001b[32m 98\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mreceive_response_headers\u001b[39m\u001b[33m\"\u001b[39m, logger, request, kwargs\n\u001b[32m 99\u001b[39m ) \u001b[38;5;28;01mas\u001b[39;00m trace:\n\u001b[32m 100\u001b[39m (\n\u001b[32m 101\u001b[39m http_version,\n\u001b[32m 102\u001b[39m status,\n\u001b[32m 103\u001b[39m reason_phrase,\n\u001b[32m 104\u001b[39m headers,\n\u001b[32m 105\u001b[39m trailing_data,\n\u001b[32m--> \u001b[39m\u001b[32m106\u001b[39m ) = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_receive_response_headers\u001b[49m\u001b[43m(\u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 107\u001b[39m trace.return_value = (\n\u001b[32m 108\u001b[39m http_version,\n\u001b[32m 109\u001b[39m status,\n\u001b[32m 110\u001b[39m reason_phrase,\n\u001b[32m 111\u001b[39m headers,\n\u001b[32m 112\u001b[39m )\n\u001b[32m 114\u001b[39m network_stream = \u001b[38;5;28mself\u001b[39m._network_stream\n",
|
| 30 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpcore\\_sync\\http11.py:177\u001b[39m, in \u001b[36mHTTP11Connection._receive_response_headers\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 174\u001b[39m timeout = timeouts.get(\u001b[33m\"\u001b[39m\u001b[33mread\u001b[39m\u001b[33m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[32m 176\u001b[39m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m177\u001b[39m event = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_receive_event\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 178\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(event, h11.Response):\n\u001b[32m 179\u001b[39m \u001b[38;5;28;01mbreak\u001b[39;00m\n",
|
| 31 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpcore\\_sync\\http11.py:217\u001b[39m, in \u001b[36mHTTP11Connection._receive_event\u001b[39m\u001b[34m(self, timeout)\u001b[39m\n\u001b[32m 214\u001b[39m event = \u001b[38;5;28mself\u001b[39m._h11_state.next_event()\n\u001b[32m 216\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m event \u001b[38;5;129;01mis\u001b[39;00m h11.NEED_DATA:\n\u001b[32m--> \u001b[39m\u001b[32m217\u001b[39m data = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_network_stream\u001b[49m\u001b[43m.\u001b[49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 218\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mREAD_NUM_BYTES\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout\u001b[49m\n\u001b[32m 219\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 221\u001b[39m \u001b[38;5;66;03m# If we feed this case through h11 we'll raise an exception like:\u001b[39;00m\n\u001b[32m 222\u001b[39m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[32m 223\u001b[39m \u001b[38;5;66;03m# httpcore.RemoteProtocolError: can't handle event type\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 227\u001b[39m \u001b[38;5;66;03m# perspective. Instead we handle this case distinctly and treat\u001b[39;00m\n\u001b[32m 228\u001b[39m \u001b[38;5;66;03m# it as a ConnectError.\u001b[39;00m\n\u001b[32m 229\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m data == \u001b[33mb\u001b[39m\u001b[33m\"\u001b[39m\u001b[33m\"\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m._h11_state.their_state == h11.SEND_RESPONSE:\n",
|
| 32 |
+
"\u001b[36mFile \u001b[39m\u001b[32mc:\\LLM\\AccentDetector\\.venv\\Lib\\site-packages\\httpcore\\_backends\\sync.py:128\u001b[39m, in \u001b[36mSyncStream.read\u001b[39m\u001b[34m(self, max_bytes, timeout)\u001b[39m\n\u001b[32m 126\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m map_exceptions(exc_map):\n\u001b[32m 127\u001b[39m \u001b[38;5;28mself\u001b[39m._sock.settimeout(timeout)\n\u001b[32m--> \u001b[39m\u001b[32m128\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_sock\u001b[49m\u001b[43m.\u001b[49m\u001b[43mrecv\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmax_bytes\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 33 |
+
"\u001b[36mFile \u001b[39m\u001b[32mC:\\Python312\\Lib\\ssl.py:1232\u001b[39m, in \u001b[36mSSLSocket.recv\u001b[39m\u001b[34m(self, buflen, flags)\u001b[39m\n\u001b[32m 1228\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m flags != \u001b[32m0\u001b[39m:\n\u001b[32m 1229\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[32m 1230\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mnon-zero flags not allowed in calls to recv() on \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[33m\"\u001b[39m %\n\u001b[32m 1231\u001b[39m \u001b[38;5;28mself\u001b[39m.\u001b[34m__class__\u001b[39m)\n\u001b[32m-> \u001b[39m\u001b[32m1232\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbuflen\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1233\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 1234\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28msuper\u001b[39m().recv(buflen, flags)\n",
|
| 34 |
+
"\u001b[36mFile \u001b[39m\u001b[32mC:\\Python312\\Lib\\ssl.py:1105\u001b[39m, in \u001b[36mSSLSocket.read\u001b[39m\u001b[34m(self, len, buffer)\u001b[39m\n\u001b[32m 1103\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m._sslobj.read(\u001b[38;5;28mlen\u001b[39m, buffer)\n\u001b[32m 1104\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m-> \u001b[39m\u001b[32m1105\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_sslobj\u001b[49m\u001b[43m.\u001b[49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mlen\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[32m 1106\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m SSLError \u001b[38;5;28;01mas\u001b[39;00m x:\n\u001b[32m 1107\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m x.args[\u001b[32m0\u001b[39m] == SSL_ERROR_EOF \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m.suppress_ragged_eofs:\n",
|
| 35 |
+
"\u001b[31mKeyboardInterrupt\u001b[39m: "
|
| 36 |
+
]
|
| 37 |
+
}
|
| 38 |
+
],
|
| 39 |
+
"source": [
|
| 40 |
+
"from openai import OpenAI\n",
|
| 41 |
+
"from dotenv import load_dotenv\n",
|
| 42 |
+
"load_dotenv(override=True)\n",
|
| 43 |
+
"client = OpenAI()\n",
|
| 44 |
+
"audio_file= open(\"./audio.wav\", \"rb\")\n",
|
| 45 |
+
"\n",
|
| 46 |
+
"transcription = client.audio.transcriptions.create(\n",
|
| 47 |
+
" model=\"gpt-4o-transcribe\", \n",
|
| 48 |
+
" file=audio_file\n",
|
| 49 |
+
")\n",
|
| 50 |
+
"\n",
|
| 51 |
+
"print(transcription.text)"
|
| 52 |
+
]
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"cell_type": "code",
|
| 56 |
+
"execution_count": 7,
|
| 57 |
+
"metadata": {},
|
| 58 |
+
"outputs": [],
|
| 59 |
+
"source": [
|
| 60 |
+
"system='''You are an intelligent assistant working for a company that builds advanced tools to automate real hiring decisions. Your task is to analyze speech-to-text transcripts from candidate interviews. For each candidateโs response, you will:\n",
|
| 61 |
+
"\n",
|
| 62 |
+
"Provide a clear and concise summary of what the candidate said.\n",
|
| 63 |
+
"\n",
|
| 64 |
+
"Identify the candidateโs motivation and key skills expressed in their speech.\n",
|
| 65 |
+
"\n",
|
| 66 |
+
"Highlight any additional insights or relevant observations that could assist recruiters in making informed hiring decisions.\n",
|
| 67 |
+
"\n",
|
| 68 |
+
"Focus on delivering objective, actionable, and relevant information that captures the candidateโs potential skills'''"
|
| 69 |
+
]
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"cell_type": "code",
|
| 73 |
+
"execution_count": 9,
|
| 74 |
+
"metadata": {},
|
| 75 |
+
"outputs": [],
|
| 76 |
+
"source": [
|
| 77 |
+
"def summarize_audio(file_path):\n",
|
| 78 |
+
" audio_file=open(\"./audio.wav\", \"rb\")\n",
|
| 79 |
+
" transcription = client.audio.transcriptions.create(\n",
|
| 80 |
+
" model=\"gpt-4o-transcribe\", \n",
|
| 81 |
+
" file=audio_file\n",
|
| 82 |
+
") \n",
|
| 83 |
+
" user_prompt=\"Here is transcription of the audio \\n \"\n",
|
| 84 |
+
" user_prompt+=transcription.text\n",
|
| 85 |
+
" prompts = [\n",
|
| 86 |
+
" {\"role\": \"system\", \"content\": system},\n",
|
| 87 |
+
" {\"role\": \"user\", \"content\": user_prompt}\n",
|
| 88 |
+
" ]\n",
|
| 89 |
+
" chat=client.chat.completions.create(\n",
|
| 90 |
+
" model='gpt-4.1-mini',\n",
|
| 91 |
+
" messages=prompts\n",
|
| 92 |
+
"\n",
|
| 93 |
+
" )\n",
|
| 94 |
+
" return chat.choices[0].message.content"
|
| 95 |
+
]
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"cell_type": "code",
|
| 99 |
+
"execution_count": 10,
|
| 100 |
+
"metadata": {},
|
| 101 |
+
"outputs": [],
|
| 102 |
+
"source": [
|
| 103 |
+
"result=summarize_audio(\"./audio.wav\")"
|
| 104 |
+
]
|
| 105 |
+
},
|
| 106 |
+
{
|
| 107 |
+
"cell_type": "code",
|
| 108 |
+
"execution_count": 11,
|
| 109 |
+
"metadata": {},
|
| 110 |
+
"outputs": [
|
| 111 |
+
{
|
| 112 |
+
"data": {
|
| 113 |
+
"text/plain": [
|
| 114 |
+
"'Summary:\\nThe candidate emphasized that anyone can perform a random act of kindness regardless of their wealth, appearance, popularity, or status.\\n\\nMotivation and Key Skills:\\n- Motivation: The candidate appears motivated by kindness and inclusivity, valuing acts of goodwill accessible to all people.\\n- Key Skills: Empathy, social awareness, and a positive attitude towards helping others.\\n\\nAdditional Insights:\\nThis response reflects an individual who values compassion and believes in simple, meaningful actions. Such a mindset can contribute to a positive workplace culture and teamwork. The candidate may bring interpersonal skills and an inclusive approach to collaboration.'"
|
| 115 |
+
]
|
| 116 |
+
},
|
| 117 |
+
"execution_count": 11,
|
| 118 |
+
"metadata": {},
|
| 119 |
+
"output_type": "execute_result"
|
| 120 |
+
}
|
| 121 |
+
],
|
| 122 |
+
"source": [
|
| 123 |
+
"result"
|
| 124 |
+
]
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"cell_type": "code",
|
| 128 |
+
"execution_count": 2,
|
| 129 |
+
"metadata": {},
|
| 130 |
+
"outputs": [
|
| 131 |
+
{
|
| 132 |
+
"name": "stderr",
|
| 133 |
+
"output_type": "stream",
|
| 134 |
+
"text": [
|
| 135 |
+
"C:\\Python312\\Lib\\asyncio\\events.py:88: DeprecationError: 2025-01-27: `modal.Cls.lookup` is deprecated and will be removed in a future release. It can be replaced with `modal.Cls.from_name`.\n",
|
| 136 |
+
"\n",
|
| 137 |
+
"See https://modal.com/docs/guide/modal-1-0-migration for more information.\n",
|
| 138 |
+
" self._context.run(self._callback, *self._args)\n"
|
| 139 |
+
]
|
| 140 |
+
}
|
| 141 |
+
],
|
| 142 |
+
"source": [
|
| 143 |
+
"from Summarizer_Agent import Summarizer\n",
|
| 144 |
+
"summarizer=Summarizer()"
|
| 145 |
+
]
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"cell_type": "code",
|
| 149 |
+
"execution_count": 5,
|
| 150 |
+
"metadata": {},
|
| 151 |
+
"outputs": [
|
| 152 |
+
{
|
| 153 |
+
"name": "stderr",
|
| 154 |
+
"output_type": "stream",
|
| 155 |
+
"text": [
|
| 156 |
+
"c:\\LLM\\AccentDetector\\Summarizer_Agent.py:38: DeprecationError: 2025-01-13: Calling a method on an uninstantiated class will soon be deprecated; update your code to instantiate the class first, i.e.:\n",
|
| 157 |
+
"Accentizer().classify instead of Accentizer.classify\n",
|
| 158 |
+
" result= self.Accentizer.classify.remote(url)\n"
|
| 159 |
+
]
|
| 160 |
+
}
|
| 161 |
+
],
|
| 162 |
+
"source": [
|
| 163 |
+
"classification_result=summarizer.classify(\"https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/data/malaysia_1.wav\")"
|
| 164 |
+
]
|
| 165 |
+
},
|
| 166 |
+
{
|
| 167 |
+
"cell_type": "code",
|
| 168 |
+
"execution_count": 6,
|
| 169 |
+
"metadata": {},
|
| 170 |
+
"outputs": [
|
| 171 |
+
{
|
| 172 |
+
"data": {
|
| 173 |
+
"text/plain": [
|
| 174 |
+
"{'label': ['malaysia'],\n",
|
| 175 |
+
" 'score': tensor([1.0000]),\n",
|
| 176 |
+
" 'index': tensor([11]),\n",
|
| 177 |
+
" 'out_prob': tensor([[1.1861e-06, 1.2055e-10, 5.3473e-11, 5.4380e-13, 2.0032e-15, 4.4907e-07,\n",
|
| 178 |
+
" 6.3841e-15, 4.1446e-15, 6.7382e-18, 1.5646e-16, 2.8600e-14, 1.0000e+00,\n",
|
| 179 |
+
" 9.1365e-11, 1.0672e-14, 2.5264e-11, 2.2511e-09]])}"
|
| 180 |
+
]
|
| 181 |
+
},
|
| 182 |
+
"execution_count": 6,
|
| 183 |
+
"metadata": {},
|
| 184 |
+
"output_type": "execute_result"
|
| 185 |
+
}
|
| 186 |
+
],
|
| 187 |
+
"source": [
|
| 188 |
+
"classification_result"
|
| 189 |
+
]
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
"cell_type": "code",
|
| 193 |
+
"execution_count": 5,
|
| 194 |
+
"metadata": {},
|
| 195 |
+
"outputs": [],
|
| 196 |
+
"source": [
|
| 197 |
+
"flags = {\n",
|
| 198 |
+
" \"us\": \"๐บ๐ธ\",\n",
|
| 199 |
+
" \"england\": \"๐ด\", # Flag of England (subdivision of UK)\n",
|
| 200 |
+
" \"australia\": \"๐ฆ๐บ\",\n",
|
| 201 |
+
" \"indian\": \"๐ฎ๐ณ\", # Assuming you meant India\n",
|
| 202 |
+
" \"canada\": \"๐จ๐ฆ\",\n",
|
| 203 |
+
" \"bermuda\": \"๐ง๐ฒ\",\n",
|
| 204 |
+
" \"scotland\": \"๐ด\", # Flag of Scotland (subdivision of UK)\n",
|
| 205 |
+
" \"african\": \"๐\", # No single African flag โ using globe showing Africa\n",
|
| 206 |
+
" \"ireland\": \"๐ฎ๐ช\",\n",
|
| 207 |
+
" \"newzealand\": \"๐ณ๐ฟ\",\n",
|
| 208 |
+
" \"wales\": \"๐ด\", # Flag of Wales (subdivision of UK)\n",
|
| 209 |
+
" \"malaysia\": \"๐ฒ๐พ\",\n",
|
| 210 |
+
" \"philippines\": \"๐ต๐ญ\",\n",
|
| 211 |
+
" \"singapore\": \"๐ธ๐ฌ\",\n",
|
| 212 |
+
" \"hongkong\": \"๐ญ๐ฐ\",\n",
|
| 213 |
+
" \"southatlandtic\": \"๐\" # Not a country โ using water wave\n",
|
| 214 |
+
"}\n"
|
| 215 |
+
]
|
| 216 |
+
},
|
| 217 |
+
{
|
| 218 |
+
"cell_type": "code",
|
| 219 |
+
"execution_count": 12,
|
| 220 |
+
"metadata": {},
|
| 221 |
+
"outputs": [],
|
| 222 |
+
"source": [
|
| 223 |
+
"\n",
|
| 224 |
+
"import gradio as gr\n",
|
| 225 |
+
"\n",
|
| 226 |
+
"def process_youtube(url):\n",
|
| 227 |
+
" try:\n",
|
| 228 |
+
" summary = summarizer.summarize(url)\n",
|
| 229 |
+
" accent_info = summarizer.classify(url)\n",
|
| 230 |
+
" \n",
|
| 231 |
+
" accent = accent_info[\"label\"]\n",
|
| 232 |
+
" flag = flags.get(accent.lower(), \"๐ณ๏ธ\") # fallback to white flag if not found\n",
|
| 233 |
+
" accent_display = f\"{flag} {accent.capitalize()}\"\n",
|
| 234 |
+
" \n",
|
| 235 |
+
" return summary, accent_display, accent_info[\"score\"]\n",
|
| 236 |
+
" except Exception as e:\n",
|
| 237 |
+
" return f\"Error: {e}\", \"N/A\", \"N/A\"\n",
|
| 238 |
+
"\n",
|
| 239 |
+
"demo = gr.Interface(\n",
|
| 240 |
+
" fn=process_youtube,\n",
|
| 241 |
+
" inputs=gr.Textbox(label=\"public video URL\", placeholder=\"Enter public video link here...\"),\n",
|
| 242 |
+
" outputs=[\n",
|
| 243 |
+
" gr.Textbox(label=\"Candidate Summary\", lines=10),\n",
|
| 244 |
+
" gr.Textbox(label=\"Detected Accent\"),\n",
|
| 245 |
+
" gr.Slider(label=\"Confidence Score (%)\", minimum=0, maximum=1, step=0.001, interactive=False)\n",
|
| 246 |
+
"\n",
|
| 247 |
+
" ],\n",
|
| 248 |
+
" title=\"Interview Audio Summarizer\",\n",
|
| 249 |
+
" description=\"Paste an interview video link. The app will summarize the candidate's response and detect the speaker's accent.\"\n",
|
| 250 |
+
")"
|
| 251 |
+
]
|
| 252 |
+
},
|
| 253 |
+
{
|
| 254 |
+
"cell_type": "code",
|
| 255 |
+
"execution_count": 13,
|
| 256 |
+
"metadata": {},
|
| 257 |
+
"outputs": [
|
| 258 |
+
{
|
| 259 |
+
"name": "stdout",
|
| 260 |
+
"output_type": "stream",
|
| 261 |
+
"text": [
|
| 262 |
+
"* Running on local URL: http://127.0.0.1:7864\n",
|
| 263 |
+
"* To create a public link, set `share=True` in `launch()`.\n"
|
| 264 |
+
]
|
| 265 |
+
},
|
| 266 |
+
{
|
| 267 |
+
"data": {
|
| 268 |
+
"text/html": [
|
| 269 |
+
"<div><iframe src=\"http://127.0.0.1:7864/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
| 270 |
+
],
|
| 271 |
+
"text/plain": [
|
| 272 |
+
"<IPython.core.display.HTML object>"
|
| 273 |
+
]
|
| 274 |
+
},
|
| 275 |
+
"metadata": {},
|
| 276 |
+
"output_type": "display_data"
|
| 277 |
+
},
|
| 278 |
+
{
|
| 279 |
+
"data": {
|
| 280 |
+
"text/plain": []
|
| 281 |
+
},
|
| 282 |
+
"execution_count": 13,
|
| 283 |
+
"metadata": {},
|
| 284 |
+
"output_type": "execute_result"
|
| 285 |
+
},
|
| 286 |
+
{
|
| 287 |
+
"name": "stdout",
|
| 288 |
+
"output_type": "stream",
|
| 289 |
+
"text": [
|
| 290 |
+
"[generic] Extracting URL: https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/data/malaysia_1.wav\n",
|
| 291 |
+
"[generic] malaysia_1: Downloading webpage\n",
|
| 292 |
+
"[info] malaysia_1: Downloading 1 format(s): wave\n",
|
| 293 |
+
"[download] Destination: audio\n",
|
| 294 |
+
"[download] 100% of 228.79KiB in 00:00:00 at 639.15KiB/s \n",
|
| 295 |
+
"[ExtractAudio] Destination: audio.mp3\n",
|
| 296 |
+
"Deleting original file audio (pass -k to keep)\n"
|
| 297 |
+
]
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"name": "stderr",
|
| 301 |
+
"output_type": "stream",
|
| 302 |
+
"text": [
|
| 303 |
+
"c:\\LLM\\AccentDetector\\Summarizer_Agent.py:38: DeprecationError: 2025-01-13: Calling a method on an uninstantiated class will soon be deprecated; update your code to instantiate the class first, i.e.:\n",
|
| 304 |
+
"Accentizer().classify instead of Accentizer.classify\n",
|
| 305 |
+
" raw= self.Accentizer.classify.remote(url)\n"
|
| 306 |
+
]
|
| 307 |
+
}
|
| 308 |
+
],
|
| 309 |
+
"source": [
|
| 310 |
+
"demo.launch()"
|
| 311 |
+
]
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"cell_type": "code",
|
| 315 |
+
"execution_count": 18,
|
| 316 |
+
"metadata": {},
|
| 317 |
+
"outputs": [
|
| 318 |
+
{
|
| 319 |
+
"name": "stdout",
|
| 320 |
+
"output_type": "stream",
|
| 321 |
+
"text": [
|
| 322 |
+
"^C\n"
|
| 323 |
+
]
|
| 324 |
+
}
|
| 325 |
+
],
|
| 326 |
+
"source": [
|
| 327 |
+
"!gradio deploy"
|
| 328 |
+
]
|
| 329 |
+
}
|
| 330 |
+
],
|
| 331 |
+
"metadata": {
|
| 332 |
+
"kernelspec": {
|
| 333 |
+
"display_name": ".venv",
|
| 334 |
+
"language": "python",
|
| 335 |
+
"name": "python3"
|
| 336 |
+
},
|
| 337 |
+
"language_info": {
|
| 338 |
+
"codemirror_mode": {
|
| 339 |
+
"name": "ipython",
|
| 340 |
+
"version": 3
|
| 341 |
+
},
|
| 342 |
+
"file_extension": ".py",
|
| 343 |
+
"mimetype": "text/x-python",
|
| 344 |
+
"name": "python",
|
| 345 |
+
"nbconvert_exporter": "python",
|
| 346 |
+
"pygments_lexer": "ipython3",
|
| 347 |
+
"version": "3.12.6"
|
| 348 |
+
}
|
| 349 |
+
},
|
| 350 |
+
"nbformat": 4,
|
| 351 |
+
"nbformat_minor": 2
|
| 352 |
+
}
|
uv.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|