ASG Models commited on
Commit
937bd52
·
verified ·
1 Parent(s): 8c63244

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -8,6 +8,23 @@ from genai_chat_ai import AI,create_chat_session
8
  API_URL = "https://api-inference.huggingface.co/models/asg2024/vits-ar-sa"
9
  api_key = os.environ.get("Id_mode_vits")
10
  headers = {"Authorization": f"Bearer {api_key}"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  def query(text):
13
  payload={"inputs": text}
@@ -30,6 +47,9 @@ def reverse_audio(text):
30
  text_answer=get_answer_ai(text)
31
 
32
  data = query(text_answer)
 
 
 
33
  return data,text_answer#(16000, np.flipud(data))
34
 
35
 
 
8
  API_URL = "https://api-inference.huggingface.co/models/asg2024/vits-ar-sa"
9
  api_key = os.environ.get("Id_mode_vits")
10
  headers = {"Authorization": f"Bearer {api_key}"}
11
+ from df.enhance import enhance, init_df, load_audio
12
+
13
+ model_enhance, df_state, _ = init_df()
14
+ def remove_noise_enhance(audio_bytes):
15
+ # save_audio("full_generation.wav", wav, 48000)
16
+
17
+
18
+ # Load default model
19
+
20
+
21
+ # Download and open some audio file. You use your audio files here
22
+
23
+ audio, sr = load_audio(audio_bytes,df_state.sr())
24
+ # Denoise the audio
25
+ enhanced = enhance(model_enhance, df_state, audio)
26
+ return df_state.sr(),enhanced
27
+
28
 
29
  def query(text):
30
  payload={"inputs": text}
 
47
  text_answer=get_answer_ai(text)
48
 
49
  data = query(text_answer)
50
+ data_enhanc = remove_noise_enhance(data)
51
+
52
+
53
  return data,text_answer#(16000, np.flipud(data))
54
 
55