Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import gradio as gr
|
|
4 |
from transformers import pipeline
|
5 |
import tempfile
|
6 |
import requests
|
|
|
7 |
|
8 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
9 |
pipe = pipeline(model="Ussen/whisper-medium-swc-drc-kat-1")
|
@@ -13,8 +14,9 @@ def transcribe(audio):
|
|
13 |
return text
|
14 |
|
15 |
def generate_response(transcribed_text):
|
16 |
-
|
17 |
-
|
|
|
18 |
messages=[
|
19 |
{
|
20 |
"role": "system",
|
|
|
4 |
from transformers import pipeline
|
5 |
import tempfile
|
6 |
import requests
|
7 |
+
client = OpenAI()
|
8 |
|
9 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
10 |
pipe = pipeline(model="Ussen/whisper-medium-swc-drc-kat-1")
|
|
|
14 |
return text
|
15 |
|
16 |
def generate_response(transcribed_text):
|
17 |
+
|
18 |
+
response = client.chat.completions.create(
|
19 |
+
model="gpt-4-1106-preview"
|
20 |
messages=[
|
21 |
{
|
22 |
"role": "system",
|