Spaces:
Runtime error
Runtime error
ASG Models
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ headers = {"Authorization": f"Bearer {api_key}"}
|
|
| 27 |
# return (df_state.sr(),np.flipud(enhanced))
|
| 28 |
|
| 29 |
|
| 30 |
-
def query(text):
|
| 31 |
payload={"inputs": text}
|
| 32 |
response = requests.post(API_URL, headers=headers, json=payload)
|
| 33 |
return response.content
|
|
@@ -43,11 +43,17 @@ def get_answer_ai(text):
|
|
| 43 |
AI=create_chat_session()
|
| 44 |
response = AI.send_message(text)
|
| 45 |
return response.text
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
text_answer=get_answer_ai(text)
|
| 49 |
-
dataq = query(text)
|
| 50 |
-
dataa = query(text_answer)
|
| 51 |
|
| 52 |
# data_enhanc = remove_noise_enhance(data)
|
| 53 |
|
|
@@ -57,7 +63,7 @@ def reverse_audio(text,intensity):
|
|
| 57 |
|
| 58 |
demo = gr.Interface(
|
| 59 |
fn=reverse_audio,
|
| 60 |
-
inputs=["text",
|
| 61 |
outputs=["audio","audio","text"]
|
| 62 |
)
|
| 63 |
|
|
|
|
| 27 |
# return (df_state.sr(),np.flipud(enhanced))
|
| 28 |
|
| 29 |
|
| 30 |
+
def query(text,API_URL):
|
| 31 |
payload={"inputs": text}
|
| 32 |
response = requests.post(API_URL, headers=headers, json=payload)
|
| 33 |
return response.content
|
|
|
|
| 43 |
AI=create_chat_session()
|
| 44 |
response = AI.send_message(text)
|
| 45 |
return response.text
|
| 46 |
+
model_choices = gr.Dropdown(
|
| 47 |
+
choices=["asg2024/vits-ar-sa", "other_model1", "other_model2"], # Replace with your model names
|
| 48 |
+
label="اختر النموذج",
|
| 49 |
+
value="asg2024/vits-ar-sa" # Default selection
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
def reverse_audio(text,model_choice):
|
| 53 |
+
API_URL = f"https://api-inference.huggingface.co/models/{model_choice}"
|
| 54 |
text_answer=get_answer_ai(text)
|
| 55 |
+
dataq = query(text,API_URL)
|
| 56 |
+
dataa = query(text_answer,API_URL)
|
| 57 |
|
| 58 |
# data_enhanc = remove_noise_enhance(data)
|
| 59 |
|
|
|
|
| 63 |
|
| 64 |
demo = gr.Interface(
|
| 65 |
fn=reverse_audio,
|
| 66 |
+
inputs=["text",model_choices],
|
| 67 |
outputs=["audio","audio","text"]
|
| 68 |
)
|
| 69 |
|