Spaces:
Sleeping
Sleeping
Update pages/🧠_sickle_cell_chatbot.py
Browse files
pages/🧠_sickle_cell_chatbot.py
CHANGED
|
@@ -40,7 +40,7 @@ class ContextChatbot:
|
|
| 40 |
self.openai_model = utils.configure_openai()
|
| 41 |
|
| 42 |
@st.cache_resource
|
| 43 |
-
def setup_chain(
|
| 44 |
file_paths = [
|
| 45 |
'./Docs/Prenatal Diagonosis.txt',
|
| 46 |
'./Docs/Sickle Cell Anaemia Yoruba.txt',
|
|
@@ -90,7 +90,7 @@ class ContextChatbot:
|
|
| 90 |
)
|
| 91 |
chain_type_kwargs = {"prompt": PROMPT}
|
| 92 |
summarizer = ChatOpenAI(model_name= "gpt-4o", temperature=0, streaming=True)
|
| 93 |
-
llm = ChatOpenAI(model_name=
|
| 94 |
|
| 95 |
chat_history = []
|
| 96 |
|
|
@@ -104,8 +104,8 @@ class ContextChatbot:
|
|
| 104 |
)
|
| 105 |
return qa
|
| 106 |
|
| 107 |
-
def transcribe_audio(
|
| 108 |
-
llm = ChatOpenAI(model_name=
|
| 109 |
response = llm.audio.transcriptions.create(
|
| 110 |
model="whisper-1",
|
| 111 |
file=("temp." + "wav", audio_bytes, "audio/wav"),
|
|
|
|
| 40 |
self.openai_model = utils.configure_openai()
|
| 41 |
|
| 42 |
@st.cache_resource
|
| 43 |
+
def setup_chain(_self):
|
| 44 |
file_paths = [
|
| 45 |
'./Docs/Prenatal Diagonosis.txt',
|
| 46 |
'./Docs/Sickle Cell Anaemia Yoruba.txt',
|
|
|
|
| 90 |
)
|
| 91 |
chain_type_kwargs = {"prompt": PROMPT}
|
| 92 |
summarizer = ChatOpenAI(model_name= "gpt-4o", temperature=0, streaming=True)
|
| 93 |
+
llm = ChatOpenAI(model_name=_self.openai_model, temperature=0, streaming=True)
|
| 94 |
|
| 95 |
chat_history = []
|
| 96 |
|
|
|
|
| 104 |
)
|
| 105 |
return qa
|
| 106 |
|
| 107 |
+
def transcribe_audio(_self, audio_bytes):
|
| 108 |
+
llm = ChatOpenAI(model_name=_self.openai_model, temperature=0, streaming=True)
|
| 109 |
response = llm.audio.transcriptions.create(
|
| 110 |
model="whisper-1",
|
| 111 |
file=("temp." + "wav", audio_bytes, "audio/wav"),
|