Upload folder using huggingface_hub
Browse files- app.py +4 -7
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -4,8 +4,8 @@ import os
|
|
| 4 |
from pathlib import Path
|
| 5 |
|
| 6 |
import gradio as gr
|
|
|
|
| 7 |
import numpy as np
|
| 8 |
-
import openai
|
| 9 |
from dotenv import load_dotenv
|
| 10 |
from fastapi import FastAPI
|
| 11 |
from fastapi.responses import HTMLResponse, StreamingResponse
|
|
@@ -13,7 +13,6 @@ from fastrtc import (
|
|
| 13 |
AdditionalOutputs,
|
| 14 |
ReplyOnPause,
|
| 15 |
Stream,
|
| 16 |
-
WebRTCError,
|
| 17 |
get_stt_model,
|
| 18 |
get_twilio_turn_credentials,
|
| 19 |
)
|
|
@@ -25,9 +24,9 @@ load_dotenv()
|
|
| 25 |
curr_dir = Path(__file__).parent
|
| 26 |
|
| 27 |
|
| 28 |
-
client =
|
| 29 |
api_key=os.environ.get("SAMBANOVA_API_KEY"),
|
| 30 |
-
|
| 31 |
)
|
| 32 |
stt_model = get_stt_model()
|
| 33 |
|
|
@@ -49,10 +48,8 @@ def response(
|
|
| 49 |
|
| 50 |
conversation_state.append({"role": "user", "content": text})
|
| 51 |
|
| 52 |
-
raise WebRTCError("test")
|
| 53 |
-
|
| 54 |
request = client.chat.completions.create(
|
| 55 |
-
model="
|
| 56 |
messages=conversation_state, # type: ignore
|
| 57 |
temperature=0.1,
|
| 58 |
top_p=0.1,
|
|
|
|
| 4 |
from pathlib import Path
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
+
import huggingface_hub
|
| 8 |
import numpy as np
|
|
|
|
| 9 |
from dotenv import load_dotenv
|
| 10 |
from fastapi import FastAPI
|
| 11 |
from fastapi.responses import HTMLResponse, StreamingResponse
|
|
|
|
| 13 |
AdditionalOutputs,
|
| 14 |
ReplyOnPause,
|
| 15 |
Stream,
|
|
|
|
| 16 |
get_stt_model,
|
| 17 |
get_twilio_turn_credentials,
|
| 18 |
)
|
|
|
|
| 24 |
curr_dir = Path(__file__).parent
|
| 25 |
|
| 26 |
|
| 27 |
+
client = huggingface_hub.InferenceClient(
|
| 28 |
api_key=os.environ.get("SAMBANOVA_API_KEY"),
|
| 29 |
+
provider="sambanova",
|
| 30 |
)
|
| 31 |
stt_model = get_stt_model()
|
| 32 |
|
|
|
|
| 48 |
|
| 49 |
conversation_state.append({"role": "user", "content": text})
|
| 50 |
|
|
|
|
|
|
|
| 51 |
request = client.chat.completions.create(
|
| 52 |
+
model="meta-llama/Llama-3.2-3B-Instruct",
|
| 53 |
messages=conversation_state, # type: ignore
|
| 54 |
temperature=0.1,
|
| 55 |
top_p=0.1,
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
fastrtc[vad, stt]
|
| 2 |
python-dotenv
|
| 3 |
-
|
| 4 |
twilio
|
|
|
|
| 1 |
fastrtc[vad, stt]
|
| 2 |
python-dotenv
|
| 3 |
+
huggingface_hub>=0.29.0
|
| 4 |
twilio
|