Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
import streamlit as st
|
4 |
+
import os
|
5 |
+
from PIL import Image
|
6 |
+
|
7 |
+
|
8 |
+
load_dotenv()
|
9 |
+
|
10 |
+
logo = Image.open('icon.jfif')
|
11 |
+
st.set_page_config(page_title = 'ChatBot', page_icon = logo)
|
12 |
+
|
13 |
+
|
14 |
+
st.markdown("<h1 style='text-align:center; color:black;'>ChatBot using LangChain</h1>", unsafe_allow_html = True)
|
15 |
+
|
16 |
+
with open('style1.css') as f:
|
17 |
+
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
|
18 |
+
|
19 |
+
input = st.text_input('Please enter your input here:')
|
20 |
+
|
21 |
+
response_button = st.button('Get Response', type = 'primary')
|
22 |
+
|
23 |
+
|
24 |
+
if response_button:
|
25 |
+
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash-lite", temperature=0.3, google_api_key=os.getenv('GOOGLE_API_KEY'))
|
26 |
+
response = llm.invoke(input).content
|
27 |
+
st.subheader('The response is')
|
28 |
+
st.write(response)
|