Spaces:
Sleeping
Sleeping
Update pages/entity_extraction.py
Browse files
pages/entity_extraction.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
from openai
|
2 |
-
client = OpenAI()
|
3 |
import streamlit as st
|
4 |
from streamlit import session_state
|
5 |
import json
|
@@ -15,7 +14,7 @@ import os
|
|
15 |
os.environ['OPENAI_API_KEY'] = "sk-proj-ZbejHdD4ZgJ5FFJ6LjMNT3BlbkFJ1WHLrJMFL03D8cMWSoFY"
|
16 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
17 |
def openai1(text1):
|
18 |
-
response =
|
19 |
model="gpt-4",
|
20 |
messages=[
|
21 |
{
|
@@ -49,7 +48,7 @@ if f is not None:
|
|
49 |
#clip.subclip(0,60).write_audiofile("theaudio.mp3")
|
50 |
# try:
|
51 |
audio_file= open("theaudio.mp3", "rb")
|
52 |
-
transcript_english =
|
53 |
model="whisper-1",
|
54 |
file=audio_file,temperature = 0).text
|
55 |
print(transcript_english)
|
|
|
1 |
+
from openai
|
|
|
2 |
import streamlit as st
|
3 |
from streamlit import session_state
|
4 |
import json
|
|
|
14 |
os.environ['OPENAI_API_KEY'] = "sk-proj-ZbejHdD4ZgJ5FFJ6LjMNT3BlbkFJ1WHLrJMFL03D8cMWSoFY"
|
15 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
16 |
def openai1(text1):
|
17 |
+
response = openai.chat.completions.create(
|
18 |
model="gpt-4",
|
19 |
messages=[
|
20 |
{
|
|
|
48 |
#clip.subclip(0,60).write_audiofile("theaudio.mp3")
|
49 |
# try:
|
50 |
audio_file= open("theaudio.mp3", "rb")
|
51 |
+
transcript_english = openai.audio.translations.create(
|
52 |
model="whisper-1",
|
53 |
file=audio_file,temperature = 0).text
|
54 |
print(transcript_english)
|