tuankg1028 commited on
Commit
458568a
·
1 Parent(s): 04df7fe

Adds dependencies and improves endpoint testing

Browse files

Adds new dependencies for enhanced functionality.

Updates the endpoint test to include comprehensive result
verification, including execution and delay times, audio saving,
and sample rate checks.

runpod_serverless/requirements.txt CHANGED
@@ -19,3 +19,17 @@ pypinyin>=0.50.0
19
  cn2an>=0.5.22
20
  inflect>=7.0.0
21
  num2words>=0.5.13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  cn2an>=0.5.22
20
  inflect>=7.0.0
21
  num2words>=0.5.13
22
+ bitsandbytes>0.37.0
23
+ gradio>=3.45.2
24
+ click
25
+ datasets
26
+ ema_pytorch>=0.5.2
27
+ hydra-core>=1.3.0
28
+ pydub
29
+ safetensors
30
+ tomli
31
+ torchdiffeq
32
+ tqdm>=4.65.0
33
+ transformers_stream_generator
34
+ wandb
35
+ x_transformers>=1.31.14
runpod_serverless/test_local.py CHANGED
@@ -49,8 +49,8 @@ def test_endpoint(endpoint_id):
49
  payload = {
50
  "input": {
51
  "ref_audio": audio_b64,
52
- "gen_text": "Đâytest từ RunPod serverless endpoint.",
53
- "speed": 1.2
54
  }
55
  }
56
 
@@ -67,7 +67,20 @@ def test_endpoint(endpoint_id):
67
  if response.status_code == 200:
68
  result = response.json()
69
  print("Endpoint test successful!")
70
- print(f"Result: {result}")
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  else:
72
  print(f"Endpoint test failed: {response.status_code}")
73
  print(f"Response: {response.text}")
 
49
  payload = {
50
  "input": {
51
  "ref_audio": audio_b64,
52
+ "gen_text": "Học vị Phó bảng được cho xuất phát từ danh hiệu \"Phụ bảng\" trong hệ thống khoa cử nhà Thanh, trong đó, những người đỗ Phụ bảng là những sĩ tử giỏi, có năng lực, nhưng số lượng quá nhiều, dẫn đến vượt quá giải ngạch mà triều đình đương thời cho phép. Áp dụng tương tự cho hệ thống khoa cử trong nước, vua Minh Mạng phê chuẩn thiết lập danh hiệu Phó bảng nhằm “ngoài những quyển trúng cách, thể văn quyển nào đầy đủ, tuy không bằng người có tên trong chính bảng, nhưng cũng có thực học thì xin vào Phó bảng” để “không để sót nhân tài”. Tuy mượn hình thức Phụ bảng của Trung Quốc, nhưng triều Nguyễn đã thay đổi theo cách riêng của mình nhằm tìm ra nhân tài phục vụ bộ máy chính quyền, chẳng hạn như ở Trung Quốc, Phụ bảng thấp hơn Cử nhân, tuy nhiên ở Việt Nam thì Phó bảng thấp hơn Tiến sĩ nhưng lại cao hơn Cử nhân.[1]",
53
+ "speed": 1
54
  }
55
  }
56
 
 
67
  if response.status_code == 200:
68
  result = response.json()
69
  print("Endpoint test successful!")
70
+ print(f"Execution time: {result.get('executionTime')}ms")
71
+ print(f"Delay time: {result.get('delayTime')}ms")
72
+
73
+ # Extract and save audio if present
74
+ if 'output' in result and 'audio_base64' in result['output']:
75
+ audio_data = base64.b64decode(result['output']['audio_base64'])
76
+ with open("output_endpoint_test.wav", "wb") as f:
77
+ f.write(audio_data)
78
+ print("Output saved as output_endpoint_test.wav")
79
+
80
+ if 'sample_rate' in result['output']:
81
+ print(f"Sample rate: {result['output']['sample_rate']}")
82
+ else:
83
+ print("No audio data found in response")
84
  else:
85
  print(f"Endpoint test failed: {response.status_code}")
86
  print(f"Response: {response.text}")