Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ import openai
|
|
11 |
import gradio as gr
|
12 |
from fpdf import FPDF as FPDF2
|
13 |
from datetime import datetime
|
|
|
14 |
|
15 |
# API 키 설정
|
16 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
@@ -135,7 +136,7 @@ def generate_blog_post(query, prompt_template):
|
|
135 |
combined_content = f"참고글1:\n{ref1}\n\n참고글2:\n{ref2}\n\n참고글3:\n{ref3}"
|
136 |
|
137 |
# 랜덤 시드 생성
|
138 |
-
random_seed = random.randint(1,
|
139 |
|
140 |
full_prompt = f"주제: {query}\n\n{prompt_template}\n\n참고 내용:\n{combined_content}"
|
141 |
|
@@ -143,11 +144,11 @@ def generate_blog_post(query, prompt_template):
|
|
143 |
model="gpt-4o-mini",
|
144 |
messages=[
|
145 |
{"role": "system", "content": prompt_template},
|
146 |
-
{"role": "user", "content":
|
147 |
],
|
148 |
max_tokens=10000,
|
149 |
-
temperature=0.
|
150 |
-
top_p=
|
151 |
frequency_penalty=0.5,
|
152 |
presence_penalty=0.3,
|
153 |
seed=random_seed
|
|
|
11 |
import gradio as gr
|
12 |
from fpdf import FPDF as FPDF2
|
13 |
from datetime import datetime
|
14 |
+
import sys
|
15 |
|
16 |
# API 키 설정
|
17 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
|
|
136 |
combined_content = f"참고글1:\n{ref1}\n\n참고글2:\n{ref2}\n\n참고글3:\n{ref3}"
|
137 |
|
138 |
# 랜덤 시드 생성
|
139 |
+
random_seed = random.randint(1, sys.maxsize)
|
140 |
|
141 |
full_prompt = f"주제: {query}\n\n{prompt_template}\n\n참고 내용:\n{combined_content}"
|
142 |
|
|
|
144 |
model="gpt-4o-mini",
|
145 |
messages=[
|
146 |
{"role": "system", "content": prompt_template},
|
147 |
+
{"role": "user", "content": f"주제: {query}\n\n참고 내용:\n{combined_content}"}
|
148 |
],
|
149 |
max_tokens=10000,
|
150 |
+
temperature=0.85,
|
151 |
+
top_p=039,
|
152 |
frequency_penalty=0.5,
|
153 |
presence_penalty=0.3,
|
154 |
seed=random_seed
|