Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,13 +22,9 @@ from PIL import Image
|
|
22 |
|
23 |
load_dotenv()
|
24 |
|
25 |
-
SYSTEM = [
|
26 |
-
"you are a helpful assistant",
|
27 |
-
"Du bist ein echzeitübersetzer. übersetze deutsch auf italienisch und italienisch auf deutsch. erkläre nichts, kommentiere nichts, füge nichts hinzu, nur übersetzen."
|
28 |
-
]
|
29 |
|
30 |
#system_message = "you are a helpful assistant."
|
31 |
-
|
32 |
|
33 |
|
34 |
def encode_audio(data: np.ndarray) -> dict:
|
@@ -66,7 +62,7 @@ class GeminiHandler(AsyncAudioVideoStreamHandler):
|
|
66 |
def copy(self) -> "GeminiHandler":
|
67 |
return GeminiHandler()
|
68 |
|
69 |
-
async def start_up(self
|
70 |
client = genai.Client(
|
71 |
api_key=os.getenv("GEMINI_API_KEY"), http_options={"api_version": "v1alpha"}
|
72 |
)
|
@@ -205,13 +201,6 @@ with gr.Blocks(css=css) as demo:
|
|
205 |
</div>
|
206 |
"""
|
207 |
)
|
208 |
-
with gr.Row():
|
209 |
-
model_dropdown = gr.Dropdown(
|
210 |
-
choices=SYSTEM,
|
211 |
-
value=SYSTEM[0],
|
212 |
-
label=""
|
213 |
-
)
|
214 |
-
|
215 |
|
216 |
with gr.Row() as row:
|
217 |
with gr.Column():
|
@@ -232,7 +221,7 @@ with gr.Blocks(css=css) as demo:
|
|
232 |
|
233 |
webrtc.stream(
|
234 |
GeminiHandler(),
|
235 |
-
inputs=[webrtc
|
236 |
outputs=[webrtc],
|
237 |
time_limit=1800 if get_space() else None,
|
238 |
concurrency_limit=2 if get_space() else None,
|
|
|
22 |
|
23 |
load_dotenv()
|
24 |
|
|
|
|
|
|
|
|
|
25 |
|
26 |
#system_message = "you are a helpful assistant."
|
27 |
+
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."
|
28 |
|
29 |
|
30 |
def encode_audio(data: np.ndarray) -> dict:
|
|
|
62 |
def copy(self) -> "GeminiHandler":
|
63 |
return GeminiHandler()
|
64 |
|
65 |
+
async def start_up(self):
|
66 |
client = genai.Client(
|
67 |
api_key=os.getenv("GEMINI_API_KEY"), http_options={"api_version": "v1alpha"}
|
68 |
)
|
|
|
201 |
</div>
|
202 |
"""
|
203 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
with gr.Row() as row:
|
206 |
with gr.Column():
|
|
|
221 |
|
222 |
webrtc.stream(
|
223 |
GeminiHandler(),
|
224 |
+
inputs=[webrtc],
|
225 |
outputs=[webrtc],
|
226 |
time_limit=1800 if get_space() else None,
|
227 |
concurrency_limit=2 if get_space() else None,
|