Reynold97 commited on
Commit
6cdcbf3
·
1 Parent(s): bc2950c

title translation

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -202,12 +202,20 @@ async def generate_article_anyscale(title, model, prompt, user_prompt):
202
  async def generate_articles(title):
203
  user_prompt= f"Siguiendo tus instrucciones y referencias redacta un artículo basado en el siguiente título. Título:'{title}'. Artículo:"
204
  en_user_promt= f"Following your instructions and references, write an article based on the following title. Title: '{title}'. Article:"
205
-
 
 
 
 
 
 
 
 
206
  openai_article, anthropic_article, anyscale_article_1, anyscale_article_2 = await asyncio.gather(
207
  generate_article_openai(title, "gpt-3.5-turbo-0125", prompt, user_prompt),
208
  generate_article_anthropic(title,"claude-3-sonnet-20240229", prompt, user_prompt),
209
  generate_article_anyscale(title, "meta-llama/Meta-Llama-3-8B-Instruct", prompt, user_prompt),
210
- generate_article_anyscale(title, "mistralai/Mistral-7B-Instruct-v0.1", en_prompt, en_user_promt),
211
  )
212
  return openai_article, anthropic_article, anyscale_article_1, anyscale_article_2
213
 
 
202
  async def generate_articles(title):
203
  user_prompt= f"Siguiendo tus instrucciones y referencias redacta un artículo basado en el siguiente título. Título:'{title}'. Artículo:"
204
  en_user_promt= f"Following your instructions and references, write an article based on the following title. Title: '{title}'. Article:"
205
+
206
+ en_title = openai_client.chat.completions.create(
207
+ model="gpt-3.5-turbo-0125",
208
+ messages=[
209
+ {"role": "system", "content": "You are a helpful English translator"},
210
+ {"role": "user", "content": f"Help me to translate this to English:{title}."}
211
+ ]
212
+ )
213
+
214
  openai_article, anthropic_article, anyscale_article_1, anyscale_article_2 = await asyncio.gather(
215
  generate_article_openai(title, "gpt-3.5-turbo-0125", prompt, user_prompt),
216
  generate_article_anthropic(title,"claude-3-sonnet-20240229", prompt, user_prompt),
217
  generate_article_anyscale(title, "meta-llama/Meta-Llama-3-8B-Instruct", prompt, user_prompt),
218
+ generate_article_anyscale(en_title, "mistralai/Mistral-7B-Instruct-v0.1", en_prompt, en_user_promt),
219
  )
220
  return openai_article, anthropic_article, anyscale_article_1, anyscale_article_2
221