omercan
commited on
Upload 3 files
Browse files- .env +1 -0
- app.py +31 -0
- requirements.txt +0 -0
.env
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
GOOGLE_API_KEY='AIzaSyDB-focl6wQi35wLBdhxhNqQs4xrrrrVX4'
|
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dotenv import load_dotenv
|
2 |
+
load_dotenv()
|
3 |
+
import streamlit as st
|
4 |
+
import os
|
5 |
+
import google.generativeai as genai
|
6 |
+
|
7 |
+
os.getenv('GOOGLE_API_KEY')
|
8 |
+
genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))
|
9 |
+
|
10 |
+
model= genai.GenerativeModel('gemini-pro')
|
11 |
+
chat=model.start_chat(history=[])
|
12 |
+
def get_response(soru):
|
13 |
+
response= chat.send_message(soru,stream=True)
|
14 |
+
return response
|
15 |
+
|
16 |
+
|
17 |
+
st.header('Omer Can Gemini Chat uygulamasi')
|
18 |
+
input=st.text_input("input", key="input")
|
19 |
+
submit=st.button('sor')
|
20 |
+
|
21 |
+
if submit:
|
22 |
+
response=get_response(input)
|
23 |
+
st.header('bombastik')
|
24 |
+
|
25 |
+
for chunck in response:
|
26 |
+
st.write(chunck.text)
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
requirements.txt
ADDED
File without changes
|