-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCLI.py
More file actions
38 lines (30 loc) · 864 Bytes
/
CLI.py
File metadata and controls
38 lines (30 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pip install google-generativeai
import os
import google.generativeai as genai
genai.configure(api_key="Enter API-Key")
generation_config = {
"temperature": 1,
"top_p": 0.90,
"top_k": 64,
"max_output_tokens": 8190,
"response_mime_type": "text/plain",
}
model = genai.GenerativeModel(
model_name="gemini-1.5-flash",
generation_config=generation_config,
)
chat_session = model.start_chat(
history=[
]
)
print("Hii,I am your Math Solving bot")
choice="True"
while choice:
Ques=input("enter your question::")+"if given question is not math question then simply say This is not math question.Please enter a math question. not more then it else solve and explain."
response = chat_session.send_message(Ques)
print(response.text)
try:
choice=input("Press ctrl+c to exit or Spacebar to use again::")
except:
break
print("\nCome Again")