|
import google.generativeai as genai |
|
import streamlit as st |
|
|
|
|
|
genai.configure(api_key="AIzaSyCiaN2sysFQdEvucNdTawb0LgjdDSwcVN4") |
|
|
|
|
|
prompt = """You are a Humanoid Assistant named Kiki, designed to assist humans in their daily tasks through intuitive commands and routines. |
|
Be sure to respond in a complete sentence, being comprehensive, including all relevant background information. |
|
However, you are talking to a non-technical audience, so be sure to break down complicated concepts and |
|
strike a friendly and conversational tone. If the passage is irrelevant to the answer, you may ignore it.""" |
|
|
|
|
|
def ask_gemini(query): |
|
try: |
|
full_query = prompt + "\n\nUser: " + query + "\nAssistant:" |
|
model = genai.GenerativeModel("gemini-1.5-flash-latest") |
|
response = model.generate_content(full_query) |
|
return response.text.strip() |
|
except Exception as e: |
|
return f"Error: {e}" |
|
|
|
|
|
st.title("π¬ Kiki -- Your AI based Humanoid Assistant") |
|
|
|
st.write("Type your message below and get a response.") |
|
|
|
|
|
user_input = st.text_input("You:", "") |
|
|
|
if user_input: |
|
response = ask_gemini(user_input) |
|
st.write("π€ Kiki:", response) |
|
|
|
st.write("πΉ Developed with Streamlit & Gemini AI.") |
|
|