Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,27 +1,46 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def text_to_speech(text):
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
# 2. تحميل النموذج والتوكنرايزر داخل المجلد المؤقت
|
14 |
-
model = VitsModel.from_pretrained("wasmdashai/vits-ar-sa-A", cache_dir=temp_model_dir)
|
15 |
-
tokenizer = AutoTokenizer.from_pretrained("wasmdashai/vits-ar-sa-A", cache_dir=temp_model_dir)
|
16 |
-
|
17 |
-
shutil.rmtree(temp_model_dir)
|
18 |
-
C+=1
|
19 |
-
print("C:",C)
|
20 |
-
return temp_model_dir # Gradio سيعرض الملف الصوتي
|
21 |
-
|
22 |
-
|
23 |
-
# 5. حذف المجلد الذي تم تحميل النموذج فيه
|
24 |
-
|
25 |
|
26 |
def cleanup_file(file_path):
|
27 |
if os.path.exists(file_path):
|
|
|
1 |
import gradio as gr
|
2 |
+
from gradio_client import Client
|
3 |
+
def ask_ai_asg(message ):
|
4 |
+
clientasg = Client("wasmdashai/dash-asg")
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
result = clientasg.predict(
|
11 |
+
text=message,
|
12 |
+
namn_model="Group",
|
13 |
+
api_name="/t2t"
|
14 |
+
)
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
return result
|
19 |
+
|
20 |
+
from gradio_client import Client
|
21 |
+
def ask_ai(message ):
|
22 |
+
|
23 |
+
client = Client("wasmdashai/T2T")
|
24 |
+
|
25 |
+
result = client.predict(
|
26 |
+
text=message,
|
27 |
+
key="AIzaSyC85_3TKmiXtOpwybhSFThZdF1nGKlxU5c",
|
28 |
+
api_name="/predict"
|
29 |
+
)
|
30 |
+
return result
|
31 |
+
|
32 |
+
def ask_asgchat(txt):
|
33 |
+
txt=ask_ai(txt)
|
34 |
+
txt=ask_ai_asg(txt)
|
35 |
+
txt=ask_ai(txt)
|
36 |
+
return txt
|
37 |
+
|
38 |
+
|
39 |
def text_to_speech(text):
|
40 |
+
|
41 |
+
return ask_asgchat(text)
|
42 |
+
|
43 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
def cleanup_file(file_path):
|
46 |
if os.path.exists(file_path):
|