pratikshahp commited on
Commit
bc84740
·
verified ·
1 Parent(s): 2f98600

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -27,7 +27,7 @@ Make sure the blog post is informative, engaging, and well-structured.
27
  """
28
 
29
  # Create a prompt template instance
30
- blog_prompt_template = ChatPromptTemplate.from_template(input_variables=["topic"], template=TEMPLATE)
31
 
32
  # Initialize the LLMChain with the HuggingFace model and prompt template
33
  blog_chain = blog_prompt_template | model | StrOutputParser()
@@ -37,10 +37,6 @@ def generate_blog_post(topic: str, author_name: str) -> str:
37
  # Generate the blog post
38
  blog_post = blog_chain.invoke({"topic": topic})
39
 
40
- # Add author name if provided
41
- if author_name:
42
- blog_post = f"**By {author_name}**\n\n" + blog_post
43
-
44
  return blog_post
45
  else:
46
  return "Please enter a topic for the blog post."
@@ -50,7 +46,6 @@ interface = gr.Interface(
50
  fn=generate_blog_post,
51
  inputs=[
52
  gr.Textbox(label="Blog Topic", placeholder="Enter the topic here"),
53
- gr.Textbox(label="Author Name", placeholder="Optional")
54
  ],
55
  outputs="text",
56
  title="AI Blog Generator",
 
27
  """
28
 
29
  # Create a prompt template instance
30
+ blog_prompt_template = ChatPromptTemplate.from_template(template=TEMPLATE)
31
 
32
  # Initialize the LLMChain with the HuggingFace model and prompt template
33
  blog_chain = blog_prompt_template | model | StrOutputParser()
 
37
  # Generate the blog post
38
  blog_post = blog_chain.invoke({"topic": topic})
39
 
 
 
 
 
40
  return blog_post
41
  else:
42
  return "Please enter a topic for the blog post."
 
46
  fn=generate_blog_post,
47
  inputs=[
48
  gr.Textbox(label="Blog Topic", placeholder="Enter the topic here"),
 
49
  ],
50
  outputs="text",
51
  title="AI Blog Generator",