Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -23,15 +23,15 @@ tts_model = get_tts_model()
|
|
23 |
conversations: dict[str, list[dict[str, str]]] = {}
|
24 |
|
25 |
|
26 |
-
llm_client = InferenceClient(provider="groq")
|
27 |
-
|
28 |
-
|
29 |
def response(
|
30 |
audio: tuple[int, np.ndarray],
|
31 |
hf_token: str | None,
|
32 |
):
|
33 |
-
if hf_token is None:
|
34 |
raise WebRTCError("HF Token is required")
|
|
|
|
|
|
|
35 |
context = get_current_context()
|
36 |
if context.webrtc_id not in conversations:
|
37 |
conversations[context.webrtc_id] = [
|
@@ -54,7 +54,6 @@ def response(
|
|
54 |
messages=messages, # type: ignore
|
55 |
max_tokens=1024,
|
56 |
stream=True,
|
57 |
-
token=hf_token,
|
58 |
)
|
59 |
|
60 |
output_text = ""
|
|
|
23 |
conversations: dict[str, list[dict[str, str]]] = {}
|
24 |
|
25 |
|
|
|
|
|
|
|
26 |
def response(
|
27 |
audio: tuple[int, np.ndarray],
|
28 |
hf_token: str | None,
|
29 |
):
|
30 |
+
if hf_token is None or hf_token == "":
|
31 |
raise WebRTCError("HF Token is required")
|
32 |
+
|
33 |
+
llm_client = InferenceClient(provider="groq", token=hf_token)
|
34 |
+
|
35 |
context = get_current_context()
|
36 |
if context.webrtc_id not in conversations:
|
37 |
conversations[context.webrtc_id] = [
|
|
|
54 |
messages=messages, # type: ignore
|
55 |
max_tokens=1024,
|
56 |
stream=True,
|
|
|
57 |
)
|
58 |
|
59 |
output_text = ""
|