hanAlex commited on
Commit
41155a0
β€’
1 Parent(s): 5dfaf9b

Update web_demo.py

Browse files
Files changed (1) hide show
  1. web_demo.py +11 -0
web_demo.py CHANGED
@@ -25,6 +25,10 @@ audio_token_pattern = re.compile(r"<\|audio_(\d+)\|>")
25
  from flow_inference import AudioDecoder
26
  from audio_process import AudioStreamProcessor
27
 
 
 
 
 
28
  if __name__ == "__main__":
29
  parser = ArgumentParser()
30
  parser.add_argument("--host", type=str, default="0.0.0.0")
@@ -60,6 +64,13 @@ if __name__ == "__main__":
60
  whisper_model = WhisperVQEncoder.from_pretrained(args.tokenizer_path).eval().to(device)
61
  feature_extractor = WhisperFeatureExtractor.from_pretrained(args.tokenizer_path)
62
 
 
 
 
 
 
 
 
63
 
64
  def clear_fn():
65
  return [], [], '', '', '', None, None
 
25
  from flow_inference import AudioDecoder
26
  from audio_process import AudioStreamProcessor
27
 
28
+ use_local_interface = True
29
+ if use_local_interface :
30
+ from model_server import ModelWorker
31
+
32
  if __name__ == "__main__":
33
  parser = ArgumentParser()
34
  parser.add_argument("--host", type=str, default="0.0.0.0")
 
64
  whisper_model = WhisperVQEncoder.from_pretrained(args.tokenizer_path).eval().to(device)
65
  feature_extractor = WhisperFeatureExtractor.from_pretrained(args.tokenizer_path)
66
 
67
+ global use_local_interface, worker
68
+ if use_local_interface :
69
+ model_path0 = 'THUDM/glm-4-voice-9b'
70
+ # dtype = 'bfloat16'
71
+ device0 = 'cpu'
72
+ worker = ModelWorker(model_path0,device0)
73
+
74
 
75
  def clear_fn():
76
  return [], [], '', '', '', None, None