eaglelandsonce commited on
Commit
297dcf2
1 Parent(s): 55d68d1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import google.generativeai as genai
3
+ from google.colab import userdata
4
+
5
+ # Setup
6
+ GOOGLE_AI_STUDIO = userdata.get('GOOGLE_AI_STUDIO2')
7
+ genai.configure(api_key=GOOGLE_AI_STUDIO)
8
+
9
+ # Model initialization
10
+ model = genai.GenerativeModel('gemini-pro')
11
+
12
+ def get_response(query):
13
+ response = model.generate_content(query)
14
+ return response.text
15
+
16
+ # Gradio interface
17
+ iface = gr.Interface(
18
+ fn=get_response,
19
+ inputs=gr.inputs.Textbox(label="Enter your query"),
20
+ outputs=gr.outputs.Textbox(label="Response"),
21
+ title="AI Content Generator",
22
+ description="Enter a query to generate content using Gemini Pro model."
23
+ )
24
+
25
+ iface.launch()