Spaces:
Runtime error
Runtime error
File size: 1,647 Bytes
da7fcd3 50b3636 da7fcd3 7a46d65 da7fcd3 f0f93bd 50b3636 f0f93bd da7fcd3 50b3636 da7fcd3 50b3636 da7fcd3 50b3636 da7fcd3 50b3636 56a194f 50b3636 56a194f f0f93bd dea5250 |
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
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)
|