import streamlit as st from langchain.prompts import PromptTemplate import os from dotenv import load_dotenv import google.generativeai as genai load_dotenv() # Configure API genai.configure(api_key=os.getenv("GOOGLE_API_KEY")) def get_gemini_response(input_text, no_words, blog_style): model = genai.GenerativeModel("gemini-pro") # Prompt Template template = """ Write a blog in {blog_style} style for the job profile. The topic is '{input_text}'. The blog should be within {no_words} words. """ prompt = PromptTemplate(input_variables=["blog_style", "input_text", "no_words"], template=template) # Generate prompt string prompt_text = prompt.format(blog_style=blog_style, input_text=input_text, no_words=no_words) # Generate response response = model.generate_content(prompt_text) return response.text st.set_page_config(page_title="Generate Blogs", layout='centered', initial_sidebar_state='collapsed') #st.header("Generate Blogs 🤖") # App name st.markdown("