Update app.py
Browse files
app.py
CHANGED
@@ -44,14 +44,14 @@ def randomize_seed_fn(seed: int) -> int:
|
|
44 |
return seed
|
45 |
|
46 |
system_instructions1 = """
|
47 |
-
[SYSTEM]
|
48 |
Keep conversation friendly, short, clear, and concise.
|
49 |
Avoid unnecessary introductions and answer the user's questions directly.
|
50 |
Respond in a normal, conversational manner while being friendly and helpful.
|
51 |
[USER]
|
52 |
"""
|
53 |
|
54 |
-
def models(text, model="
|
55 |
seed = int(randomize_seed_fn(seed))
|
56 |
generator = torch.Generator().manual_seed(seed)
|
57 |
|
@@ -85,7 +85,7 @@ async def respond(audio, model, seed):
|
|
85 |
user = transcribe(audio)
|
86 |
reply = models(user, model, seed)
|
87 |
# Change the voice to a deep male voice
|
88 |
-
communicate = edge_tts.Communicate(reply, voice="en-US-
|
89 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
90 |
tmp_path = tmp_file.name
|
91 |
await communicate.save(tmp_path)
|
@@ -103,7 +103,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
103 |
'Mistral 7B v0.3',
|
104 |
'Phi 3 mini',
|
105 |
],
|
106 |
-
value="
|
107 |
label="Model"
|
108 |
)
|
109 |
seed = gr.Slider(
|
|
|
44 |
return seed
|
45 |
|
46 |
system_instructions1 = """
|
47 |
+
[SYSTEM] You are Optimus Optimus a personal AI voice assistant, Created by Jaward.
|
48 |
Keep conversation friendly, short, clear, and concise.
|
49 |
Avoid unnecessary introductions and answer the user's questions directly.
|
50 |
Respond in a normal, conversational manner while being friendly and helpful.
|
51 |
[USER]
|
52 |
"""
|
53 |
|
54 |
+
def models(text, model="Llama 3B Service", seed=42):
|
55 |
seed = int(randomize_seed_fn(seed))
|
56 |
generator = torch.Generator().manual_seed(seed)
|
57 |
|
|
|
85 |
user = transcribe(audio)
|
86 |
reply = models(user, model, seed)
|
87 |
# Change the voice to a deep male voice
|
88 |
+
communicate = edge_tts.Communicate(reply, voice="en-US-ChristopherNeural")
|
89 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
90 |
tmp_path = tmp_file.name
|
91 |
await communicate.save(tmp_path)
|
|
|
103 |
'Mistral 7B v0.3',
|
104 |
'Phi 3 mini',
|
105 |
],
|
106 |
+
value="Llama 3B Service",
|
107 |
label="Model"
|
108 |
)
|
109 |
seed = gr.Slider(
|