Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +34 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""chatMe.ipynb
|
| 3 |
+
|
| 4 |
+
Automatically generated by Colab.
|
| 5 |
+
|
| 6 |
+
Original file is located at
|
| 7 |
+
https://colab.research.google.com/drive/1UoKqF9Ve7YWhkkF-Zd-opjO6y98Abd6q
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
#!/usr/bin/env python
|
| 11 |
+
# coding: utf-8
|
| 12 |
+
|
| 13 |
+
# In[ ]:
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
import streamlit as st
|
| 17 |
+
import google.generativeai as genai
|
| 18 |
+
|
| 19 |
+
genai.configure(api_key='AIzaSyCuQrYVURvgQiqAV-pSX9C3cOT_K7Cj7CA')
|
| 20 |
+
|
| 21 |
+
st.title('Chat with Me')
|
| 22 |
+
model = genai.GenerativeModel('gemini-1.5-pro-latest')
|
| 23 |
+
chat = model.start_chat(history=[])
|
| 24 |
+
|
| 25 |
+
soru = st.text_input('Sen:')
|
| 26 |
+
|
| 27 |
+
if st.button('Sor'):
|
| 28 |
+
response = chat.send_message(soru)
|
| 29 |
+
st.write(response.text)
|
| 30 |
+
st.write(chat.history)
|
| 31 |
+
|
| 32 |
+
if st.button('Yeni Sohbet'):
|
| 33 |
+
chat = model.start_chat(history=chat.history)
|
| 34 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
google-generativeai
|