Spaces:
Runtime error
Runtime error
english prompt for mistral
Browse files
app.py
CHANGED
@@ -114,7 +114,20 @@ puedes instalar unas pequeñas cortinas, que sean ligeras para que dejen pasar l
|
|
114 |
por barillas estilo bambú en la barandilla, que además aportan un toque natural.\
|
115 |
"""
|
116 |
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
api_key = os.getenv("OPENAI_API_KEY")
|
119 |
print(f"Starting OpenAI request at: {datetime.datetime.now().time()}")
|
120 |
async with httpx.AsyncClient(timeout=120.0) as client:
|
@@ -137,7 +150,7 @@ async def generate_article_openai(title, model):
|
|
137 |
print(f"OpenAI response received at: {datetime.datetime.now().time()}")
|
138 |
return response_data['choices'][0]['message']['content']
|
139 |
|
140 |
-
async def generate_article_anthropic(title, model):
|
141 |
api_key = os.getenv("ANTHROPIC_API_KEY")
|
142 |
print(f"Starting Anthropic request at: {datetime.datetime.now().time()}")
|
143 |
async with httpx.AsyncClient(timeout=120.0) as client:
|
@@ -162,7 +175,7 @@ async def generate_article_anthropic(title, model):
|
|
162 |
print(f"Anthropic response received at: {datetime.datetime.now().time()}")
|
163 |
return response_data['content'][0]['text']
|
164 |
|
165 |
-
async def generate_article_anyscale(title, model):
|
166 |
print(f"Starting Anyscale request at: {datetime.datetime.now().time()}")
|
167 |
api_key = os.getenv("ANYSCALE_API_KEY")
|
168 |
async with httpx.AsyncClient(timeout=120.0) as client:
|
@@ -188,10 +201,10 @@ async def generate_article_anyscale(title, model):
|
|
188 |
|
189 |
async def generate_articles(title):
|
190 |
openai_article, anthropic_article, anyscale_article_1, anyscale_article_2 = await asyncio.gather(
|
191 |
-
generate_article_openai(title, "gpt-3.5-turbo-0125"),
|
192 |
-
generate_article_anthropic(title,"claude-3-sonnet-20240229"),
|
193 |
-
generate_article_anyscale(title, "meta-llama/Meta-Llama-3-8B-Instruct"),
|
194 |
-
generate_article_anyscale(title, "mistralai/Mistral-7B-Instruct-v0.1"),
|
195 |
)
|
196 |
return openai_article, anthropic_article, anyscale_article_1, anyscale_article_2
|
197 |
|
|
|
114 |
por barillas estilo bambú en la barandilla, que además aportan un toque natural.\
|
115 |
"""
|
116 |
|
117 |
+
en_prompt = """
|
118 |
+
You are a writing assistant for a blog and newspaper about women, women's lifestyle, tips, and tricks. Your task is to draft brief, entertaining, and engaging articles based on a title. The articles must be SEO-optimized, as we want the blog to rank among the top Google search results for keywords related to the title. Here are several examples of developed articles; you should replicate their writing style to ensure your articles represent the blog's brand:
|
119 |
+
|
120 |
+
Title: Personal growth movies that will make you rethink your attitude towards problems.
|
121 |
+
Article: Cinema, like literature, can teach us great lessons, especially about overcoming yourself and achieving success and happiness. Although the main goal of the film industry is entertainment, it is true that there is increasingly a bet on films with a message that goes beyond, that resonates with viewers. For this reason, we have seen many stories of relevant characters in recent years, who have had to go through a lot before achieving success. This encourages personal improvement, to set goals that you really want to achieve. This genre has already been categorized as "conscious cinema" or "spiritual cinema," and is one of the most followed today. This can be applied both personally and professionally. We leave you our favorites that, if you haven't seen them, you already have plans for the next weekend. The Pursuit of Happyness: It is already a classic that should no longer be on your pending list. Its protagonist, Chris Gardner (Will Smith), faces all kinds of problems and obstacles to achieve his dream. It is a story where we see that perseverance is a quality that can make a difference on the path to success and happiness. Life is Beautiful: It takes place during the Second World War, and it is one of those stories that, once you have seen it, will mark a before and after in your life. A father and his son, from a Jewish family, are sent to a concentration camp and, despite this terrible context, the father tries to convince the little one that everything they are experiencing is just a contest and to see the positive side of that situation. Forrest Gump: If you haven't seen it, we don't know what you are waiting for. It is a beautiful film, starring Tom Hanks, and one of the most famous personal growth stories. The character is a man with a mental disability, but with great vitality, who seeks to live like a normal person, wanting to run, fall in love, and make the most of every little detail. Into the Wild: It is one of those films based on real events that we mentioned at the beginning. It is the story of Christopher McCandless, a 22-year-old who, after graduating from college, wanted to escape everything that disturbed him and embark on a solo backpacking trip. He ended up in an abandoned bus, spending four months alone, but discovering himself. Silver Linings Playbook: This film tells the life of Pat (Bradley Cooper), who has difficulty controlling his anger, so he was sentenced after assaulting his ex-wife's lover. After this episode, he meets Tiffany, a girl with problems who offers to help him get his wife back. The relationship between them is a roller coaster of feelings and emotions, from anger to the purest generosity, shaping each other as they get to know each other. The final dissatisfaction is ultimately turned into happiness.
|
122 |
+
|
123 |
+
Title: Unleash your inner Sisu, the Finnish secret to success and happiness
|
124 |
+
Article: Despite the cold and low temperatures, the Nordic country is one of the happiest. We reveal their success philosophy. It is true that during the winter we are more apathetic, with less desire to make plans and socialize, which directly affects our mood. So, how is it possible that, in a country like Finland with sub-zero temperatures, its citizens are among the happiest? It seems that what happens around them has no impact on them, always being carefree, serene, and full of vitality. This is thanks to a well-kept secret, but one that has already become one of the most popular philosophies worldwide: sisu. What is sisu and where does the term come from? It is a concept with a long history behind it, dating back almost a century. It was born during World War II, in 1939, when the Soviet Union declared war on the Lapland country. With 800,000 Finnish soldiers, against 2 million Russians, the victory of who was going to win was practically sung. Even with these predictions, the Nordics held out hard for 105 consecutive days until peace was signed between both countries, leaving for history this word that still names the imitated philosophy of life of the Finns. Therefore, sisu is conceived as the attitude of not giving up, despite all the obstacles and inconveniences that may appear along the way. In the language of the Finns, it translates as "inside" or "interior," so it is related to the fact of bringing out our inner strength and fighting despite adversities. This is not intrinsic to the Nordic country, but it is something that everyone can apply to their life, in order to improve our physical and mental state. From including good habits in our routine to setting (realistic) goals and tracing our path to achieve them. Tips for unleashing our inner sisu - Develop patience: it is a quality that is very difficult to work on, especially today with the frantic pace of life we lead, but if you propose it, it can mean a before and after in your way of seeing things. - Devote time to oneself: chosen solitude is one of the great unexplored pleasures that you surely have pending. Spending time alone, getting to know yourself, figuring out what we want and what has no place in our lives… all this can only be known through self-knowledge. - The small pleasures of life: not everything has to be a great experience, like traveling to the other end of the world, but savoring those small details, like the smell of freshly made coffee or a sunset bet, can teach you gratitude and that happiness can come in small doses. - Face stress with a good face: everyone has their peaks of stress, it is normal, but you have to know how to handle them. We cannot be overwhelmed by anxiety and fear, but we must learn to control them and turn them into something positive. - Communication is the basis of everything: when you have a problem or a misunderstanding, the solution is not to lock yourself up, as you end up in a spiral of negativity that leads to nothing. This is where communication comes in, but the healthy kind that allows us to express our point of view in an empathetic and respectful way with others.
|
125 |
+
|
126 |
+
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):
|
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(title, model, 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(title, model, 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:
|
|
|
201 |
|
202 |
async def generate_articles(title):
|
203 |
openai_article, anthropic_article, anyscale_article_1, anyscale_article_2 = await asyncio.gather(
|
204 |
+
generate_article_openai(title, "gpt-3.5-turbo-0125", prompt),
|
205 |
+
generate_article_anthropic(title,"claude-3-sonnet-20240229", prompt),
|
206 |
+
generate_article_anyscale(title, "meta-llama/Meta-Llama-3-8B-Instruct", prompt),
|
207 |
+
generate_article_anyscale(title, "mistralai/Mistral-7B-Instruct-v0.1", en_prompt),
|
208 |
)
|
209 |
return openai_article, anthropic_article, anyscale_article_1, anyscale_article_2
|
210 |
|