Manikandan-Alagu commited on
Commit
75e9e3d
·
verified ·
1 Parent(s): 83cc201

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import os
3
+ import gradio as gr
4
+
5
+ import google.generativeai as genai
6
+
7
+ GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY", None)
8
+ genai.configure(api_key=GEMINI_API_KEY)
9
+
10
+ # Create the model
11
+ generation_config = {
12
+ "temperature": 1,
13
+ "top_p": 0.95,
14
+ "top_k": 64,
15
+ "max_output_tokens": 8192,
16
+ "response_mime_type": "text/plain",
17
+ }
18
+
19
+ model = genai.GenerativeModel(
20
+ model_name="gemini-1.5-flash",
21
+ generation_config=generation_config,
22
+ # safety_settings = Adjust safety settings
23
+ # See https://ai.google.dev/gemini-api/docs/safety-settings
24
+ system_instruction="give the response in friendly tone",
25
+ )
26
+
27
+ chat_session = model.start_chat(
28
+ history=[
29
+
30
+ ]
31
+ )
32
+
33
+ response = chat_session.send_message("INSERT_INPUT_HERE")
34
+
35
+ print(response.text)