cloud-sean commited on
Commit
789d787
·
verified ·
1 Parent(s): 248d419

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -1,17 +1,25 @@
1
-
2
  import streamlit as st
3
  import docx2txt
4
  import openai
5
  import os
6
 
7
  os.environ["OPENAI_API_BASE"] = openai.api_type = "azure"
8
- os.environ["OPENAI_API_KEY"] = openai.api_key = os.environ["OPENAI_API_KEY"]
9
- os.environ["OPENAI_API_BASE"] = openai.api_base = os.environ["OPENAI_API_BASE"]
10
  os.environ["OPENAI_API_VERSION"] = openai.api_version = "2023-03-15-preview"
11
 
 
 
 
 
 
 
 
 
 
12
  def translate(text, language):
13
  message_text = [{"role":"system","content":f"You are an AI translator that translates documents to {language}. Do not put anything before or after the text you want to translate. Just return the translated text. At the end of your translation generate a table of important information that could be helpful for quick identification by a human (this section should be in english).: \n \n Text to Translate: {text}"}]
14
- # Create a completion request to Azure OpenAI
15
  completion = openai.ChatCompletion.create(
16
  engine="gpt-4",
17
  messages = message_text,
 
 
1
  import streamlit as st
2
  import docx2txt
3
  import openai
4
  import os
5
 
6
  os.environ["OPENAI_API_BASE"] = openai.api_type = "azure"
7
+ os.environ["OPENAI_API_KEY"] = openai.api_key = os.environ.get("OPENAI_API_KEY")
8
+ os.environ["OPENAI_API_BASE"] = openai.api_base = "https://seansworkspace-aoai.openai.azure.com/"
9
  os.environ["OPENAI_API_VERSION"] = openai.api_version = "2023-03-15-preview"
10
 
11
+ # os.environ["OPENAI_API_BASE"] = openai.api_type = "azure"
12
+ # os.environ["OPENAI_API_KEY"] = openai.api_key = os.environ["OPENAI_API_KEY"]
13
+ # os.environ["OPENAI_API_BASE"] = openai.api_base = os.environ["OPENAI_API_BASE"]
14
+ # os.environ["OPENAI_API_VERSION"] = openai.api_version = "2023-03-15-preview"
15
+ # # Sample prompt for the AI
16
+
17
+
18
+
19
+
20
  def translate(text, language):
21
  message_text = [{"role":"system","content":f"You are an AI translator that translates documents to {language}. Do not put anything before or after the text you want to translate. Just return the translated text. At the end of your translation generate a table of important information that could be helpful for quick identification by a human (this section should be in english).: \n \n Text to Translate: {text}"}]
22
+ # Create a completion request to Azure OpenAI
23
  completion = openai.ChatCompletion.create(
24
  engine="gpt-4",
25
  messages = message_text,