MCPcopy Create free account
hub / github.com/FunAudioLLM/MME-Emotion / process_json_file

Function process_json_file

extract_step/ER-Lab/code/extract_step.py:59–79  ·  view source on GitHub ↗
(input_file, output_file, model_name, api_key, base_url)

Source from the content-addressed store, hash-verified

57 return False
58
59def process_json_file(input_file, output_file, model_name, api_key, base_url):
60
61 with open(input_file, 'r') as f:
62 data = json.load(f)
63
64 #data = data[:10]
65
66 client = OpenAI(api_key=api_key, base_url=base_url)
67
68 success_count = 0
69 for entry in tqdm(data, desc="Processing entries"):
70
71 if 'label_set' in entry:
72 del entry['label_set']
73 if process_entry(model_name, client, entry):
74 success_count += 1
75
76 with open(output_file, 'w') as f:
77 json.dump(data, f, indent=2, ensure_ascii=False)
78
79 print(f"\nProcessing completed. Success: {success_count}/{len(data)}")
80
81if __name__ == "__main__":
82 parser = argparse.ArgumentParser(description="Process emotion recognition results with GPT-4")

Callers 1

extract_step.pyFile · 0.70

Calls 1

process_entryFunction · 0.70

Tested by

no test coverage detected