TDN-M commited on
Commit
ab0cac2
·
verified ·
1 Parent(s): 7ddaffb

Update content_generation.py

Browse files
Files changed (1) hide show
  1. content_generation.py +7 -5
content_generation.py CHANGED
@@ -113,8 +113,9 @@ def extract_key_contents(script, num_contents=30):
113
  Trích xuất các ý chính từ script.
114
  """
115
  try:
116
- response = openai_client.chat.completions.create(
117
- model="gpt-3.5-turbo",
 
118
  messages=[
119
  {"role": "system", "content": f"Bạn là một chuyên gia phân tích nội dung. Hãy trích xuất chính xác {num_contents} ý chính quan trọng nhất từ đoạn văn sau, mỗi ý không quá 20 từ."},
120
  {"role": "user", "content": script}
@@ -122,7 +123,7 @@ def extract_key_contents(script, num_contents=30):
122
  )
123
 
124
  # In response để kiểm tra
125
- print("Response từ OpenAI:", response)
126
 
127
  key_contents = response.choices[0].message.content.split('\n')
128
  return key_contents[:num_contents]
@@ -135,8 +136,9 @@ def generate_image_prompt(content):
135
  Tạo prompt cho hình ảnh từ nội dung.
136
  """
137
  try:
138
- response = openai_client.chat.completions.create(
139
- model="gpt-3.5-turbo",
 
140
  messages=[
141
  {"role": "system", "content": "You are an expert at creating prompts for AI image generation. Create a short, concise prompt in English to visually describe the following content. The content may be in Vietnamese, but your prompt should always be in English."},
142
  {"role": "user", "content": content}
 
113
  Trích xuất các ý chính từ script.
114
  """
115
  try:
116
+ client = Groq(api_key=GROQ_API_KEY)
117
+ chat_completion = client.chat.completions.create(
118
+ model="mixtral-8x7b-32768",
119
  messages=[
120
  {"role": "system", "content": f"Bạn là một chuyên gia phân tích nội dung. Hãy trích xuất chính xác {num_contents} ý chính quan trọng nhất từ đoạn văn sau, mỗi ý không quá 20 từ."},
121
  {"role": "user", "content": script}
 
123
  )
124
 
125
  # In response để kiểm tra
126
+ print("Response:", response)
127
 
128
  key_contents = response.choices[0].message.content.split('\n')
129
  return key_contents[:num_contents]
 
136
  Tạo prompt cho hình ảnh từ nội dung.
137
  """
138
  try:
139
+ client = Groq(api_key=GROQ_API_KEY)
140
+ chat_completion = client.chat.completions.create(
141
+ model="mixtral-8x7b-32768",
142
  messages=[
143
  {"role": "system", "content": "You are an expert at creating prompts for AI image generation. Create a short, concise prompt in English to visually describe the following content. The content may be in Vietnamese, but your prompt should always be in English."},
144
  {"role": "user", "content": content}