Spaces:
Runtime error
Runtime error
ASG Models
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,14 +10,18 @@ def reverse_audio(audio):
|
|
| 10 |
return (sr, np.flipud(data))
|
| 11 |
|
| 12 |
# Use a pipeline as a high-level helper
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
pipe = pipeline("text-to-speech", model="asg2024/vits-ar-sa")
|
| 16 |
-
def inputText(text):
|
| 17 |
-
return text
|
| 18 |
demo = gr.Interface(
|
| 19 |
fn=reverse_audio,
|
| 20 |
-
inputs=
|
| 21 |
outputs="audio"
|
| 22 |
)
|
| 23 |
|
|
|
|
| 10 |
return (sr, np.flipud(data))
|
| 11 |
|
| 12 |
# Use a pipeline as a high-level helper
|
| 13 |
+
import requests
|
| 14 |
+
|
| 15 |
+
API_URL = "https://api-inference.huggingface.co/models/asg2024/vits-ar-sa"
|
| 16 |
+
|
| 17 |
+
def query(text):
|
| 18 |
+
payload={"inputs": text}
|
| 19 |
+
response = requests.post(API_URL, json=payload)
|
| 20 |
+
return response.content
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
demo = gr.Interface(
|
| 23 |
fn=reverse_audio,
|
| 24 |
+
inputs=query,
|
| 25 |
outputs="audio"
|
| 26 |
)
|
| 27 |
|