Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -17,9 +17,10 @@ from llama_index.core import (
|
|
17 |
|
18 |
from llama_index.agent.openai import OpenAIAgent
|
19 |
from llama_index.core.tools import FunctionTool
|
20 |
-
from llama_index.llms.openai import (
|
21 |
-
OpenAI
|
22 |
-
)
|
|
|
23 |
#from openai import OpenAI as OpenAIClient
|
24 |
|
25 |
#per i file multimediali
|
@@ -261,10 +262,10 @@ class BasicAgent:
|
|
261 |
def _transcribe_audio(self, audio_bytes: BytesIO) -> str:
|
262 |
#audio_file = BytesIO(audio_bytes)
|
263 |
#transcription = self.client.audio.transcriptions.create(model="whisper-1", file=audio_bytes)
|
264 |
-
transcription =
|
265 |
file=audio_bytes,
|
266 |
model="whisper-1",
|
267 |
-
api_key=os.getenv(openai_api_key)
|
268 |
)
|
269 |
print_coso(f"usato _transcribe_audio: {transcription}")
|
270 |
return transcription.text.strip()
|
|
|
17 |
|
18 |
from llama_index.agent.openai import OpenAIAgent
|
19 |
from llama_index.core.tools import FunctionTool
|
20 |
+
#from llama_index.llms.openai import (
|
21 |
+
# OpenAI
|
22 |
+
#)
|
23 |
+
from openai import OpenAI
|
24 |
#from openai import OpenAI as OpenAIClient
|
25 |
|
26 |
#per i file multimediali
|
|
|
262 |
def _transcribe_audio(self, audio_bytes: BytesIO) -> str:
|
263 |
#audio_file = BytesIO(audio_bytes)
|
264 |
#transcription = self.client.audio.transcriptions.create(model="whisper-1", file=audio_bytes)
|
265 |
+
transcription = self.client.audio.transcriptions.create(
|
266 |
file=audio_bytes,
|
267 |
model="whisper-1",
|
268 |
+
#api_key=os.getenv(openai_api_key)
|
269 |
)
|
270 |
print_coso(f"usato _transcribe_audio: {transcription}")
|
271 |
return transcription.text.strip()
|