adil9858 commited on
Commit
9d3324a
·
1 Parent(s): c594225

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from IPython.display import Markdown
3
+ import google.generativeai as genai
4
+
5
+ # Configure Google GenAI
6
+ api_key = 'AIzaSyA7jXPscK6XqztKHkZB-QDE_OjpEzZQDCU'
7
+ genai.configure(api_key=api_key)
8
+
9
+ # Initialize GenerativeModel
10
+ model = genai.GenerativeModel('gemini-pro')
11
+
12
+ # Streamlit app
13
+ st.title("Hugging Face Space with Streamlit")
14
+
15
+ # Input text box for user query
16
+ user_query = st.text_input("Enter your query:")
17
+
18
+ if st.button("Generate"):
19
+ # Generate content using the model
20
+ response = model.generate_content(user_query)
21
+
22
+ # Display the generated content using Markdown
23
+ st.markdown(response.text)
24
+
25
+ # Run the app
26
+ if __name__ == "__main__":
27
+ st.set_page_config(page_title="Hugging Face Space", page_icon=":rocket:")
28
+ st.run_app()