Spaces:
Sleeping
Sleeping
Commit ·
c7b90e4
1
Parent(s): deeeb78
rm unessary comment
Browse files4 unmodified lines56789101119 unmodified lines3132333334353637103 unmodified lines14114214314314414514614713 unmodified lines16116216316316416516616734 unmodified lines2022032042042052062074 unmodified lines
import gradio as grimport requestsfrom bs4 import BeautifulSoupfrom openai import OpenAI
street_interview = False19 unmodified lines self.speaker_mapping = {} self._load_transcript() self._process_transcript() self.map_speaker_ids_to_names() # Map speaker IDs to names self.map_speaker_ids_to_names()
def _load_transcript(self) -> None: """Load the transcript JSON file."""103 unmodified lines for segment in self.segments: spk_id = f"spk_{segment.speaker_id}" speaker_name = self.speaker_mapping.get(spk_id, spk_id) segment.speaker_name = speaker_name # Store the speaker name segment.speaker_name = speaker_name
# Recreate the formatted transcript with speaker names formatted_segments = []13 unmodified lines def correct_speaker_mapping_with_agenda(self, url: str) -> None: """Fetch agenda from a URL and correct the speaker mapping using OpenAI.""" try: # Fetch the HTML content from the URL
response = requests.get(url) response.raise_for_status() html_content = response.text34 unmodified lines "You should only update the name if the name sounds very similar, or there is a good spelling overlap/ The Speaker Introduction matches the description of the Talk from Agends. If the name is totally unrelated, keep the original name." )
# Use OpenAI API to get corrected mapping client = OpenAI()
completion = client.chat.completions.create(app.py+4-4