Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ def generate_filename(prompt, file_type):
|
|
48 |
return f"{safe_date_time}_{safe_prompt}.{file_type}"
|
49 |
|
50 |
def transcribe_audio(file_path, model):
|
51 |
-
key = os.getenv('
|
52 |
headers = {
|
53 |
"Authorization": f"Bearer {key}",
|
54 |
}
|
@@ -199,7 +199,7 @@ def chat_with_model(prompt, document_section, model_choice='gpt-3.5-turbo'):
|
|
199 |
collected_chunks = []
|
200 |
collected_messages = []
|
201 |
|
202 |
-
key = os.getenv('
|
203 |
openai.api_key = key
|
204 |
for chunk in openai.ChatCompletion.create(
|
205 |
model='gpt-3.5-turbo',
|
@@ -303,7 +303,7 @@ def txt2chunks(text):
|
|
303 |
return text_splitter.split_text(text)
|
304 |
|
305 |
def vector_store(text_chunks):
|
306 |
-
key = os.getenv('
|
307 |
embeddings = OpenAIEmbeddings(openai_api_key=key)
|
308 |
return FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
309 |
|
@@ -365,7 +365,7 @@ def get_zip_download_link(zip_file):
|
|
365 |
|
366 |
|
367 |
def main():
|
368 |
-
#openai.api_key = os.getenv('
|
369 |
|
370 |
# File type for output, model choice
|
371 |
menu = ["txt", "htm", "xlsx", "csv", "md", "py"]
|
|
|
48 |
return f"{safe_date_time}_{safe_prompt}.{file_type}"
|
49 |
|
50 |
def transcribe_audio(file_path, model):
|
51 |
+
key = os.getenv('OPENAI_API_KEY')
|
52 |
headers = {
|
53 |
"Authorization": f"Bearer {key}",
|
54 |
}
|
|
|
199 |
collected_chunks = []
|
200 |
collected_messages = []
|
201 |
|
202 |
+
key = os.getenv('OPENAI_API_KEY')
|
203 |
openai.api_key = key
|
204 |
for chunk in openai.ChatCompletion.create(
|
205 |
model='gpt-3.5-turbo',
|
|
|
303 |
return text_splitter.split_text(text)
|
304 |
|
305 |
def vector_store(text_chunks):
|
306 |
+
key = os.getenv('OPENAI_API_KEY')
|
307 |
embeddings = OpenAIEmbeddings(openai_api_key=key)
|
308 |
return FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
309 |
|
|
|
365 |
|
366 |
|
367 |
def main():
|
368 |
+
#openai.api_key = os.getenv('OPENAI_API_KEY')
|
369 |
|
370 |
# File type for output, model choice
|
371 |
menu = ["txt", "htm", "xlsx", "csv", "md", "py"]
|