Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,9 @@ import random
|
|
6 |
import time
|
7 |
|
8 |
import gradio as gr
|
9 |
-
import
|
10 |
|
11 |
-
|
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 =
|
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 |
)
|