jpwahle commited on
Commit
4c466d5
1 Parent(s): 66f9591

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -6,9 +6,9 @@ import random
6
  import time
7
 
8
  import gradio as gr
9
- import openai
10
 
11
- openai.api_key = os.environ.get("OPENAI_API_KEY")
12
 
13
 
14
  def create_prompt(sentence, paraphrase_type):
@@ -117,7 +117,7 @@ with gr.Blocks() as demo:
117
  types_as_str = ",".join(paraphrase_type)
118
  history[-1][1] = f"[System: {types_as_str}]\n\n"
119
  prompt = create_prompt(history[-1][0], paraphrase_type)
120
- bot_message = openai.ChatCompletion.create(
121
  model="ft:gpt-4o-mini-2024-07-18:personal::ADQ0IcdZ",
122
  messages=prompt["messages"],
123
  )
 
6
  import time
7
 
8
  import gradio as gr
9
+ from openai import OpenAI
10
 
11
+ client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
12
 
13
 
14
  def create_prompt(sentence, paraphrase_type):
 
117
  types_as_str = ",".join(paraphrase_type)
118
  history[-1][1] = f"[System: {types_as_str}]\n\n"
119
  prompt = create_prompt(history[-1][0], paraphrase_type)
120
+ bot_message = client.chat.completions.create(
121
  model="ft:gpt-4o-mini-2024-07-18:personal::ADQ0IcdZ",
122
  messages=prompt["messages"],
123
  )