Spaces:
Sleeping
Sleeping
changed llm
Browse files
app.py
CHANGED
@@ -18,7 +18,8 @@ llm = Llama.from_pretrained(
|
|
18 |
)
|
19 |
|
20 |
#guardrail model
|
21 |
-
guard_llm = "llama-guard-3-8b"
|
|
|
22 |
|
23 |
#marketing prompt
|
24 |
marketing_email_prompt = """Below is a product and description, please write a marketing email for this product.
|
@@ -73,12 +74,12 @@ async def topical_guardrail(user_request):
|
|
73 |
return response.choices[0].message.content
|
74 |
|
75 |
async def greet(product,description):
|
76 |
-
|
77 |
product, # product
|
78 |
description, # description
|
79 |
"", # output - leave this blank for generation!
|
80 |
)
|
81 |
-
topical_guardrail_task = asyncio.create_task(topical_guardrail(
|
82 |
while True:
|
83 |
done, _ = await asyncio.wait(
|
84 |
[topical_guardrail_task], return_when=asyncio.FIRST_COMPLETED
|
|
|
18 |
)
|
19 |
|
20 |
#guardrail model
|
21 |
+
#guard_llm = "llama-guard-3-8b"
|
22 |
+
guard_llm = "llama-3.1-8b-instant"
|
23 |
|
24 |
#marketing prompt
|
25 |
marketing_email_prompt = """Below is a product and description, please write a marketing email for this product.
|
|
|
74 |
return response.choices[0].message.content
|
75 |
|
76 |
async def greet(product,description):
|
77 |
+
user_reques = marketing_email_prompt.format(
|
78 |
product, # product
|
79 |
description, # description
|
80 |
"", # output - leave this blank for generation!
|
81 |
)
|
82 |
+
topical_guardrail_task = asyncio.create_task(topical_guardrail(user_reques))
|
83 |
while True:
|
84 |
done, _ = await asyncio.wait(
|
85 |
[topical_guardrail_task], return_when=asyncio.FIRST_COMPLETED
|