Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,9 @@ from PIL import Image
|
|
22 |
|
23 |
load_dotenv()
|
24 |
|
|
|
|
|
|
|
25 |
|
26 |
def encode_audio(data: np.ndarray) -> dict:
|
27 |
"""Encode Audio data to send to the server"""
|
@@ -69,8 +72,7 @@ class GeminiHandler(AsyncAudioVideoStreamHandler):
|
|
69 |
]
|
70 |
|
71 |
system_instruction = types.Content(
|
72 |
-
parts=[types.Part.from_text(text="
|
73 |
-
#Du bist ein echzeitübersetzer. übersetze deutsch auf italienisch und italienisch auf deutsch. erkläre nichts, kommentiere nichts, füge nichts hinzu, nur übersetzen.
|
74 |
role="user"
|
75 |
)
|
76 |
|
@@ -78,8 +80,9 @@ class GeminiHandler(AsyncAudioVideoStreamHandler):
|
|
78 |
config = types.LiveConnectConfig(
|
79 |
response_modalities=["AUDIO"],
|
80 |
speech_config=types.SpeechConfig(
|
|
|
81 |
voice_config=types.VoiceConfig(
|
82 |
-
prebuilt_voice_config=types.PrebuiltVoiceConfig(voice_name="
|
83 |
)
|
84 |
),
|
85 |
tools=tools,
|
|
|
22 |
|
23 |
load_dotenv()
|
24 |
|
25 |
+
#system_message = "you are a helpful assistant."
|
26 |
+
system_message = "Du bist ein echzeitübersetzer. übersetze deutsch auf italienisch und italienisch auf deutsch. erkläre nichts, kommentiere nichts, füge nichts hinzu, nur übersetzen."
|
27 |
+
|
28 |
|
29 |
def encode_audio(data: np.ndarray) -> dict:
|
30 |
"""Encode Audio data to send to the server"""
|
|
|
72 |
]
|
73 |
|
74 |
system_instruction = types.Content(
|
75 |
+
parts=[types.Part.from_text(text=f"{system_message}")],
|
|
|
76 |
role="user"
|
77 |
)
|
78 |
|
|
|
80 |
config = types.LiveConnectConfig(
|
81 |
response_modalities=["AUDIO"],
|
82 |
speech_config=types.SpeechConfig(
|
83 |
+
language_code="de-DE",
|
84 |
voice_config=types.VoiceConfig(
|
85 |
+
prebuilt_voice_config=types.PrebuiltVoiceConfig(voice_name="Puck")
|
86 |
)
|
87 |
),
|
88 |
tools=tools,
|