wasmdashai commited on
Commit
1bed993
·
verified ·
1 Parent(s): c358865

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -25,6 +25,16 @@ generation_config = {
25
  "max_output_tokens": 8192,
26
  "response_mime_type": "text/plain",
27
  }
 
 
 
 
 
 
 
 
 
 
28
 
29
  model = genai.GenerativeModel(
30
  model_name="gemini-1.5-pro",
@@ -187,6 +197,9 @@ def get_answer_ai(text,session_ai):
187
  return response,session_ai
188
 
189
  def modelspeech(text):
 
 
 
190
  with torch.no_grad():
191
  inputs = tokenizer(text, return_tensors="pt")#.cuda()
192
 
 
25
  "max_output_tokens": 8192,
26
  "response_mime_type": "text/plain",
27
  }
28
+ import requests
29
+
30
+ API_URL = "https://api-inference.huggingface.co/models/wasmdashai/vits-ar-sa-huba"
31
+ headers = {"Authorization": f"Bearer {token}"}
32
+
33
+ def query(payload):
34
+ response = requests.post(API_URL, headers=headers, json=payload)
35
+ return response.content
36
+
37
+
38
 
39
  model = genai.GenerativeModel(
40
  model_name="gemini-1.5-pro",
 
197
  return response,session_ai
198
 
199
  def modelspeech(text):
200
+ audio_bytes = query({
201
+ "inputs":text })
202
+ return audio_bytes
203
  with torch.no_grad():
204
  inputs = tokenizer(text, return_tensors="pt")#.cuda()
205