File size: 628 Bytes
727acb8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2009db6
727acb8
a225bc0
727acb8
 
 
3d23455
727acb8
 
 
 
 
 
 
 
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
from dotenv import load_dotenv
load_dotenv()
import streamlit as st 
import os
import google.generativeai as genai

os.getenv('GOOGLE_API_KEY')
genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))

model= genai.GenerativeModel('gemini-pro')
chat=model.start_chat(history=[])
def get_response(soru):
    response= chat.send_message(soru,stream=True)
    return response


st.header('Yapay Zeka Chat Uygulamasi.')
input=st.text_input("input", key="input")
submit=st.button('Bana sor')

if submit:
    response=get_response(input)
    st.header('Cevap:')

    for chunck in response:
        st.write(chunck.text)