Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,27 @@ from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
|
| 6 |
from langchain_core.output_parsers import StrOutputParser
|
| 7 |
from langchain_community.chat_message_histories import SQLChatMessageHistory
|
| 8 |
from langchain_core.runnables.history import RunnableWithMessageHistory
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Load API key
|
| 11 |
GOOGLE_API_KEY = st.secrets.get("GOOGLE_API_KEY")
|
| 12 |
|
|
@@ -82,9 +102,7 @@ chat = RunnableWithMessageHistory(
|
|
| 82 |
history_messages_key="history"
|
| 83 |
)
|
| 84 |
|
| 85 |
-
|
| 86 |
-
st.title("Conversational AI Data Science Tutor")
|
| 87 |
-
st.write("Ask me anything about Data Science!")
|
| 88 |
|
| 89 |
# Load chat history and keep it sticky
|
| 90 |
if "messages" not in st.session_state:
|
|
|
|
| 6 |
from langchain_core.output_parsers import StrOutputParser
|
| 7 |
from langchain_community.chat_message_histories import SQLChatMessageHistory
|
| 8 |
from langchain_core.runnables.history import RunnableWithMessageHistory
|
| 9 |
+
import time
|
| 10 |
+
|
| 11 |
+
# Set page config
|
| 12 |
+
st.set_page_config(page_title="Gemini Code Reviewer", layout="wide")
|
| 13 |
+
|
| 14 |
+
# Animated text function
|
| 15 |
+
def animated_text(text, speed=0.05):
|
| 16 |
+
placeholder = st.empty()
|
| 17 |
+
displayed_text = ""
|
| 18 |
+
for letter in text:
|
| 19 |
+
displayed_text += letter
|
| 20 |
+
placeholder.markdown(f"""
|
| 21 |
+
<h1 style="text-align:center; color: #FF4500;">{displayed_text} 🚀</h1>
|
| 22 |
+
""", unsafe_allow_html=True) # Corrected f-string formatting
|
| 23 |
+
time.sleep(speed)
|
| 24 |
+
|
| 25 |
+
# Display animated text
|
| 26 |
+
animated_text("Conversational AI Data Science Tutor", speed=0.1)
|
| 27 |
+
|
| 28 |
+
# Streamlit Ui
|
| 29 |
+
st.write("Ask me anything about Data Science!")
|
| 30 |
# Load API key
|
| 31 |
GOOGLE_API_KEY = st.secrets.get("GOOGLE_API_KEY")
|
| 32 |
|
|
|
|
| 102 |
history_messages_key="history"
|
| 103 |
)
|
| 104 |
|
| 105 |
+
|
|
|
|
|
|
|
| 106 |
|
| 107 |
# Load chat history and keep it sticky
|
| 108 |
if "messages" not in st.session_state:
|