khatri-indra commited on
Commit
4ccb4d5
·
verified ·
1 Parent(s): afc82e6

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +28 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+ import os
3
+ import streamlit as st
4
+ import google.generativeai as genai
5
+
6
+
7
+ load_dotenv()
8
+
9
+ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
10
+
11
+
12
+ model = genai.GenerativeModel("gemini-pro")
13
+ def get_gemini_response(question):
14
+ response = model.generate_content(question)
15
+ return response.text
16
+
17
+ st.set_page_config(page_title="Q&A Chatbot")
18
+
19
+ st.header("Ask your questions to Gemini")
20
+
21
+ input = st.text_input("Question: ", key="input")
22
+ submit = st.button("Ask to Gemini")
23
+
24
+
25
+ if submit:
26
+ response = get_gemini_response(input)
27
+ st.subheader("Answer is")
28
+ st.write(response)
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ langchain
2
+ streamlit
3
+ google-generativeai
4
+ python-dotenv