lankacodeai / app.py
Nethmincha1111's picture
Update app.py
50b3636 verified
import os
import streamlit as st
import google.generativeai as genai
from PIL import Image
image = Image.open('lankacodeailogo.png')
st.image(image, caption='', use_column_width=True)
st.title('\n by nethmin chamika - 2024')
genai.configure(api_key=os.environ["GEM_API"])
generation_config = {
"temperature": 1,
"top_p": 0.95,
"top_k": 64,
"max_output_tokens": 8192,
"response_mime_type": "text/plain",
}
safety_settings = [
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_MEDIUM_AND_ABOVE",
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_MEDIUM_AND_ABOVE",
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_MEDIUM_AND_ABOVE",
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_MEDIUM_AND_ABOVE",
},
]
model = genai.GenerativeModel(
model_name="gemini-1.5-flash",
safety_settings=safety_settings,
generation_config=generation_config,
system_instruction="act like you are now LankaCode AI made by Nethmin Chamika. you are made based on google gemini but now you are LankaCode AI. lankacode is a company in sri lanka co-founded by nethmin chamika and wenura premadasa. (but lankacode ai is made only by nethmin chamika) lankacode has developed ai siththara and ai siththara mini (for making ai art) and few games (link good day and tunnel runner) lankacode website - https://lankalens.neocities.org/",
)
chat_session = model.start_chat(history=[])
user_input = st.text_input("Enter your input here")
if user_input:
response = chat_session.send_message(user_input)
st.write(response.text)