Upload 3 files
Browse files- .env +1 -0
- app.py +33 -0
- requirements.txt +3 -0
.env
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
GOOGLE_API_KEY = "AIzaSyBBrePLC0eqi2LTVio-a7fyFKDqnoB9HdM"
|
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import os
|
3 |
+
import google.generativeai as genai
|
4 |
+
from dotenv import load_dotenv
|
5 |
+
|
6 |
+
#Load environment variables from .env file
|
7 |
+
load_dotenv()
|
8 |
+
|
9 |
+
# Configure api
|
10 |
+
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
11 |
+
|
12 |
+
# Function to load Gemini Pro model and get responses
|
13 |
+
model = genai.GenerativeModel("gemini-1.5-pro")
|
14 |
+
def get_gemini_response(question):
|
15 |
+
response=model.generate_content(question)
|
16 |
+
return response.text
|
17 |
+
|
18 |
+
# Initialize streamlit app
|
19 |
+
st.set_page_config(page_title="GemQuest")
|
20 |
+
|
21 |
+
# App name
|
22 |
+
st.markdown("<h4 style='text-align: center;'>GemQuest</h4>", unsafe_allow_html=True)
|
23 |
+
|
24 |
+
# Input and submit
|
25 |
+
input=st.text_input(" ", key="input", placeholder="Ask GemQuest")
|
26 |
+
submit=st.button("Submit")
|
27 |
+
|
28 |
+
## When submit is clicked
|
29 |
+
if submit:
|
30 |
+
response=get_gemini_response(input)
|
31 |
+
st.write(response)
|
32 |
+
|
33 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
google-generativeai
|
3 |
+
python-dotenv
|