Spaces:
Runtime error
Runtime error
ASG Models
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -158,18 +158,7 @@ def get_answer_ai(text):
|
|
| 158 |
return response.text
|
| 159 |
|
| 160 |
with gr.Blocks() as demo: # Use gr.Blocks to wrap the entire interface
|
| 161 |
-
|
| 162 |
-
model_choices = gr.Dropdown(
|
| 163 |
-
choices=[
|
| 164 |
-
"asg2024/vits-ar-sa",
|
| 165 |
-
"asg2024/vits-ar-sa-huba",
|
| 166 |
-
"asg2024/vits-ar-sa-ms",
|
| 167 |
-
"asg2024/vits-ar-sa-magd",
|
| 168 |
-
"asg2024/vits-ar-sa-fahd",
|
| 169 |
-
],
|
| 170 |
-
label="اختر النموذج",
|
| 171 |
-
value="asg2024/vits-ar-sa",
|
| 172 |
-
)
|
| 173 |
with gr.Tab("Chat AI "):
|
| 174 |
gr.Markdown("## AI: محادثة صوتية بالذكاء الاصطناعي باللهجة السعودية")
|
| 175 |
with gr.Row(): # Arrange input/output components side-by-side
|
|
@@ -180,7 +169,18 @@ with gr.Blocks() as demo: # Use gr.Blocks to wrap the entire interface
|
|
| 180 |
btn = gr.Button("إرسال")
|
| 181 |
btn_ai_only = gr.Button("توليد رد الذكاء الاصطناعي فقط")
|
| 182 |
|
| 183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
ai_audio = gr.Audio(label="رد الذكاء الاصطناعي الصوتي")
|
| 185 |
ai_text = gr.Textbox(label="رد الذكاء الاصطناعي النصي")
|
| 186 |
|
|
@@ -216,12 +216,24 @@ with gr.Blocks() as demo: # Use gr.Blocks to wrap the entire interface
|
|
| 216 |
with gr.Row():
|
| 217 |
text_input = gr.Textbox(label="أدخل النص هنا")
|
| 218 |
speaker_id_input = gr.Number(label="معرّف المتحدث (اختياري)", interactive=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
generate_button = gr.Button("توليد وتشغيل الصوت")
|
| 220 |
|
| 221 |
audio_player = gr.Audio(label="أ audio",streaming=True)
|
| 222 |
|
| 223 |
# Update the event binding
|
| 224 |
-
|
| 225 |
|
| 226 |
|
| 227 |
|
|
|
|
| 158 |
return response.text
|
| 159 |
|
| 160 |
with gr.Blocks() as demo: # Use gr.Blocks to wrap the entire interface
|
| 161 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
with gr.Tab("Chat AI "):
|
| 163 |
gr.Markdown("## AI: محادثة صوتية بالذكاء الاصطناعي باللهجة السعودية")
|
| 164 |
with gr.Row(): # Arrange input/output components side-by-side
|
|
|
|
| 169 |
btn = gr.Button("إرسال")
|
| 170 |
btn_ai_only = gr.Button("توليد رد الذكاء الاصطناعي فقط")
|
| 171 |
|
| 172 |
+
with gr.Column():
|
| 173 |
+
model_choices = gr.Dropdown(
|
| 174 |
+
choices=[
|
| 175 |
+
"asg2024/vits-ar-sa",
|
| 176 |
+
"asg2024/vits-ar-sa-huba",
|
| 177 |
+
"asg2024/vits-ar-sa-ms",
|
| 178 |
+
"asg2024/vits-ar-sa-magd",
|
| 179 |
+
"asg2024/vits-ar-sa-fahd",
|
| 180 |
+
],
|
| 181 |
+
label="اختر النموذج",
|
| 182 |
+
value="asg2024/vits-ar-sa",
|
| 183 |
+
)
|
| 184 |
ai_audio = gr.Audio(label="رد الذكاء الاصطناعي الصوتي")
|
| 185 |
ai_text = gr.Textbox(label="رد الذكاء الاصطناعي النصي")
|
| 186 |
|
|
|
|
| 216 |
with gr.Row():
|
| 217 |
text_input = gr.Textbox(label="أدخل النص هنا")
|
| 218 |
speaker_id_input = gr.Number(label="معرّف المتحدث (اختياري)", interactive=True)
|
| 219 |
+
with gr.Column():
|
| 220 |
+
model_choices2 = gr.Dropdown(
|
| 221 |
+
choices=[
|
| 222 |
+
"asg2024/vits-ar-sa",
|
| 223 |
+
"asg2024/vits-ar-sa-huba",
|
| 224 |
+
"asg2024/vits-ar-sa-ms",
|
| 225 |
+
"asg2024/vits-ar-sa-magd",
|
| 226 |
+
"asg2024/vits-ar-sa-fahd",
|
| 227 |
+
],
|
| 228 |
+
label="اختر النموذج",
|
| 229 |
+
value="asg2024/vits-ar-sa",
|
| 230 |
+
)
|
| 231 |
generate_button = gr.Button("توليد وتشغيل الصوت")
|
| 232 |
|
| 233 |
audio_player = gr.Audio(label="أ audio",streaming=True)
|
| 234 |
|
| 235 |
# Update the event binding
|
| 236 |
+
generate_button.click(generate_audio, inputs=[text_input,model_choices2], outputs=audio_player)
|
| 237 |
|
| 238 |
|
| 239 |
|