mazed commited on
Commit
040b2b7
·
verified ·
1 Parent(s): 8810bdb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -33
app.py CHANGED
@@ -1,33 +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
-
 
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 the 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
+