Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#------------------------------------------------Import Packages---------------------------------------------#
|
| 2 |
+
from langchain_google_genai import GoogleGenerativeAI
|
| 3 |
+
import streamlit as st
|
| 4 |
+
from utils import load_mode_get_respose
|
| 5 |
+
import os
|
| 6 |
+
#-----------------------------------------------------------------------------------------------------------#
|
| 7 |
+
|
| 8 |
+
st.set_page_config(
|
| 9 |
+
page_title="QnA Chat Bot",
|
| 10 |
+
page_icon="🤖",
|
| 11 |
+
layout="centered",
|
| 12 |
+
initial_sidebar_state="auto"
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
st.title("QnA Chat Bot")
|
| 16 |
+
|
| 17 |
+
question=st.text_input("Enter Question:\n")
|
| 18 |
+
resposne=load_mode_get_respose(question=question)
|
| 19 |
+
if st.button('Reponse'):
|
| 20 |
+
st.write_stream(resposne)
|
| 21 |
+
|
| 22 |
+
|
utils.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#------------------------------------------------Import Packages---------------------------------------------#
|
| 2 |
+
from langchain_google_genai import GoogleGenerativeAI
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
import os
|
| 5 |
+
#-----------------------------------------------------------------------------------------------------------#
|
| 6 |
+
load_dotenv()
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# make a fun to load the genai model and get resposne
|
| 11 |
+
def load_mode_get_respose(question:str):
|
| 12 |
+
llm=GoogleGenerativeAI(google_api_key=os.environ['google_api'],
|
| 13 |
+
model='gemini-1.5-pro',temperature=0.4)
|
| 14 |
+
|
| 15 |
+
respose=llm(question)
|
| 16 |
+
yield respose
|