Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,12 @@ from PIL import Image
|
|
22 |
|
23 |
load_dotenv()
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
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 |
|
@@ -61,7 +66,7 @@ class GeminiHandler(AsyncAudioVideoStreamHandler):
|
|
61 |
def copy(self) -> "GeminiHandler":
|
62 |
return GeminiHandler()
|
63 |
|
64 |
-
async def start_up(self):
|
65 |
client = genai.Client(
|
66 |
api_key=os.getenv("GEMINI_API_KEY"), http_options={"api_version": "v1alpha"}
|
67 |
)
|
@@ -199,7 +204,15 @@ with gr.Blocks(css=css) as demo:
|
|
199 |
</center>
|
200 |
</div>
|
201 |
"""
|
202 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
with gr.Row() as row:
|
204 |
with gr.Column():
|
205 |
webrtc = WebRTC(
|
@@ -219,7 +232,7 @@ with gr.Blocks(css=css) as demo:
|
|
219 |
|
220 |
webrtc.stream(
|
221 |
GeminiHandler(),
|
222 |
-
inputs=[webrtc],
|
223 |
outputs=[webrtc],
|
224 |
time_limit=1800 if get_space() else None,
|
225 |
concurrency_limit=2 if get_space() else None,
|
|
|
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 |
#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."
|
32 |
|
33 |
|
|
|
66 |
def copy(self) -> "GeminiHandler":
|
67 |
return GeminiHandler()
|
68 |
|
69 |
+
async def start_up(system_message, self):
|
70 |
client = genai.Client(
|
71 |
api_key=os.getenv("GEMINI_API_KEY"), http_options={"api_version": "v1alpha"}
|
72 |
)
|
|
|
204 |
</center>
|
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():
|
218 |
webrtc = WebRTC(
|
|
|
232 |
|
233 |
webrtc.stream(
|
234 |
GeminiHandler(),
|
235 |
+
inputs=[model_dropdown, webrtc],
|
236 |
outputs=[webrtc],
|
237 |
time_limit=1800 if get_space() else None,
|
238 |
concurrency_limit=2 if get_space() else None,
|