Reynold97 commited on
Commit
aa0d18f
1 Parent(s): 6cdcbf3
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -127,7 +127,7 @@ Title: These are the best tricks to make the most of a small terrace.
127
  Article: The time is approaching to start enjoying outdoor plans, and these are some tricks to decorate that small space you have at home efficiently. With the imminent arrival of spring, with the rising temperatures and sunny days it brings, the plans in outdoor spaces kick off, with terraces being the quintessential meeting place with friends and family. And we are not only referring to classic leisure places, like bars and restaurants, but if you are one of the privileged ones who has a small space in your home, there are some tricks you can note to make the most of it. The first thing you have to be clear about is what you want to do with that terrace, what you want to dedicate it to. This will make it easier to choose the decoration, because if you prefer it to be a casual meeting place, you will opt for some good sofas, while if you need it to organize lunches, a large table and chairs are essential. When choosing furniture, whatever it may be, it is best to opt for light ones with simple designs, as they will make the space not so overloaded, giving a feeling of spaciousness. Although the best thing is that they are foldable, as this is essential in a small terrace. Multifunctional furniture is also a great alternative, such as a puff that serves as a small table, or reclining chairs that allow you to sit down to eat and also sunbathe as a sun lounger. The motto of "quality better than quantity" makes complete sense in these cases. As for the chromatic range, we also have preferences when it comes to an outdoor room, with white being the best bet, especially if you receive a lot of natural light. This can be applied both in the decorative elements and on the walls, being able to combine them with other colors like blue or terracotta. Another key element, beyond the furniture, are the plants, which are usually the great protagonists in this type of area, as they add that natural touch to the space, which is always well received. In the case of small terraces, and in order to save space, you can always place them with planters on the railing or vertically on the wall. Lighting is super important, especially during those spring nights, when you can enjoy the warm night air. It is advisable to opt for options that provide an air of intimacy, such as lanterns or a string of lights. Finally, privacy is something we value a lot in outdoor spaces, since you are more exposed. But for this problem, there are also aesthetic and efficient solutions. If the terrace allows it, you can install light curtains that let in light, although it is most common to opt for bamboo-style bars on the railing, which also add a natural touch.
128
  """
129
 
130
- async def generate_article_openai(title, model, prompt, user_prompt):
131
  api_key = os.getenv("OPENAI_API_KEY")
132
  print(f"Starting OpenAI request at: {datetime.datetime.now().time()}")
133
  async with httpx.AsyncClient(timeout=120.0) as client:
@@ -150,7 +150,7 @@ async def generate_article_openai(title, model, prompt, user_prompt):
150
  print(f"OpenAI response received at: {datetime.datetime.now().time()}")
151
  return response_data['choices'][0]['message']['content']
152
 
153
- async def generate_article_anthropic(title, model, prompt, user_prompt):
154
  api_key = os.getenv("ANTHROPIC_API_KEY")
155
  print(f"Starting Anthropic request at: {datetime.datetime.now().time()}")
156
  async with httpx.AsyncClient(timeout=120.0) as client:
@@ -175,7 +175,7 @@ async def generate_article_anthropic(title, model, prompt, user_prompt):
175
  print(f"Anthropic response received at: {datetime.datetime.now().time()}")
176
  return response_data['content'][0]['text']
177
 
178
- async def generate_article_anyscale(title, model, prompt, user_prompt):
179
  print(f"Starting Anyscale request at: {datetime.datetime.now().time()}")
180
  api_key = os.getenv("ANYSCALE_API_KEY")
181
  async with httpx.AsyncClient(timeout=120.0) as client:
@@ -200,9 +200,6 @@ async def generate_article_anyscale(title, model, prompt, user_prompt):
200
 
201
 
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=[
@@ -211,11 +208,15 @@ async def generate_articles(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
 
 
127
  Article: The time is approaching to start enjoying outdoor plans, and these are some tricks to decorate that small space you have at home efficiently. With the imminent arrival of spring, with the rising temperatures and sunny days it brings, the plans in outdoor spaces kick off, with terraces being the quintessential meeting place with friends and family. And we are not only referring to classic leisure places, like bars and restaurants, but if you are one of the privileged ones who has a small space in your home, there are some tricks you can note to make the most of it. The first thing you have to be clear about is what you want to do with that terrace, what you want to dedicate it to. This will make it easier to choose the decoration, because if you prefer it to be a casual meeting place, you will opt for some good sofas, while if you need it to organize lunches, a large table and chairs are essential. When choosing furniture, whatever it may be, it is best to opt for light ones with simple designs, as they will make the space not so overloaded, giving a feeling of spaciousness. Although the best thing is that they are foldable, as this is essential in a small terrace. Multifunctional furniture is also a great alternative, such as a puff that serves as a small table, or reclining chairs that allow you to sit down to eat and also sunbathe as a sun lounger. The motto of "quality better than quantity" makes complete sense in these cases. As for the chromatic range, we also have preferences when it comes to an outdoor room, with white being the best bet, especially if you receive a lot of natural light. This can be applied both in the decorative elements and on the walls, being able to combine them with other colors like blue or terracotta. Another key element, beyond the furniture, are the plants, which are usually the great protagonists in this type of area, as they add that natural touch to the space, which is always well received. In the case of small terraces, and in order to save space, you can always place them with planters on the railing or vertically on the wall. Lighting is super important, especially during those spring nights, when you can enjoy the warm night air. It is advisable to opt for options that provide an air of intimacy, such as lanterns or a string of lights. Finally, privacy is something we value a lot in outdoor spaces, since you are more exposed. But for this problem, there are also aesthetic and efficient solutions. If the terrace allows it, you can install light curtains that let in light, although it is most common to opt for bamboo-style bars on the railing, which also add a natural touch.
128
  """
129
 
130
+ async def generate_article_openai(model, prompt, user_prompt):
131
  api_key = os.getenv("OPENAI_API_KEY")
132
  print(f"Starting OpenAI request at: {datetime.datetime.now().time()}")
133
  async with httpx.AsyncClient(timeout=120.0) as client:
 
150
  print(f"OpenAI response received at: {datetime.datetime.now().time()}")
151
  return response_data['choices'][0]['message']['content']
152
 
153
+ async def generate_article_anthropic(model, prompt, user_prompt):
154
  api_key = os.getenv("ANTHROPIC_API_KEY")
155
  print(f"Starting Anthropic request at: {datetime.datetime.now().time()}")
156
  async with httpx.AsyncClient(timeout=120.0) as client:
 
175
  print(f"Anthropic response received at: {datetime.datetime.now().time()}")
176
  return response_data['content'][0]['text']
177
 
178
+ async def generate_article_anyscale(model, prompt, user_prompt):
179
  print(f"Starting Anyscale request at: {datetime.datetime.now().time()}")
180
  api_key = os.getenv("ANYSCALE_API_KEY")
181
  async with httpx.AsyncClient(timeout=120.0) as client:
 
200
 
201
 
202
  async def generate_articles(title):
 
 
 
203
  en_title = openai_client.chat.completions.create(
204
  model="gpt-3.5-turbo-0125",
205
  messages=[
 
208
  ]
209
  )
210
 
211
+ user_prompt= f"Siguiendo tus instrucciones y referencias redacta un artículo basado en el siguiente título. Título:'{title}'. Artículo:"
212
+ en_user_promt= f"Following your instructions and references, write an article based on the following title. Title: '{en_title}'. Article:"
213
+
214
+
215
  openai_article, anthropic_article, anyscale_article_1, anyscale_article_2 = await asyncio.gather(
216
+ generate_article_openai("gpt-3.5-turbo-0125", prompt, user_prompt),
217
+ generate_article_anthropic("claude-3-sonnet-20240229", prompt, user_prompt),
218
+ generate_article_anyscale("meta-llama/Meta-Llama-3-8B-Instruct", prompt, user_prompt),
219
+ generate_article_anyscale("mistralai/Mistral-7B-Instruct-v0.1", en_prompt, en_user_promt),
220
  )
221
  return openai_article, anthropic_article, anyscale_article_1, anyscale_article_2
222