Spaces:
Sleeping
Sleeping
github-actions
commited on
Commit
Β·
8421e01
1
Parent(s):
8b7e891
Sync updates from source repository
Browse files
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title: "
|
3 |
emoji: π
|
4 |
colorFrom: indigo
|
5 |
colorTo: green
|
@@ -8,7 +8,7 @@ sdk_version: 1.32.2
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
-
short_description: "
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: "My Title"
|
3 |
emoji: π
|
4 |
colorFrom: indigo
|
5 |
colorTo: green
|
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
+
short_description: "Enter Description Here"
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -3,23 +3,12 @@ from query import VectaraQuery
|
|
3 |
import os
|
4 |
|
5 |
import streamlit as st
|
6 |
-
import logging
|
7 |
from PIL import Image
|
8 |
from dotenv import load_dotenv
|
9 |
|
10 |
|
11 |
load_dotenv(override=False)
|
12 |
|
13 |
-
|
14 |
-
logging.basicConfig(filename='./app.log', level=logging.INFO, format='%(asctime)s - %(message)s',
|
15 |
-
datefmt='%Y-%m-%d %H:%M:%S')
|
16 |
-
|
17 |
-
def log_query(query):
|
18 |
-
logging.info(f'Query: {query}')
|
19 |
-
|
20 |
-
def log_visit():
|
21 |
-
logging.info(f"Demo: {str(os.environ['title'])}")
|
22 |
-
|
23 |
def isTrue(x) -> bool:
|
24 |
if isinstance(x, bool):
|
25 |
return x
|
@@ -75,8 +64,6 @@ def launch_bot():
|
|
75 |
if "messages" not in st.session_state.keys():
|
76 |
st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
|
77 |
|
78 |
-
log_visit()
|
79 |
-
|
80 |
# Display chat messages
|
81 |
for message in st.session_state.messages:
|
82 |
with st.chat_message(message["role"]):
|
@@ -84,7 +71,6 @@ def launch_bot():
|
|
84 |
|
85 |
# User-provided prompt
|
86 |
if prompt := st.chat_input():
|
87 |
-
log_query(prompt)
|
88 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
89 |
with st.chat_message("user"):
|
90 |
st.write(prompt)
|
@@ -103,4 +89,5 @@ def launch_bot():
|
|
103 |
st.session_state.messages.append(message)
|
104 |
|
105 |
if __name__ == "__main__":
|
106 |
-
launch_bot()
|
|
|
|
3 |
import os
|
4 |
|
5 |
import streamlit as st
|
|
|
6 |
from PIL import Image
|
7 |
from dotenv import load_dotenv
|
8 |
|
9 |
|
10 |
load_dotenv(override=False)
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
def isTrue(x) -> bool:
|
13 |
if isinstance(x, bool):
|
14 |
return x
|
|
|
64 |
if "messages" not in st.session_state.keys():
|
65 |
st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
|
66 |
|
|
|
|
|
67 |
# Display chat messages
|
68 |
for message in st.session_state.messages:
|
69 |
with st.chat_message(message["role"]):
|
|
|
71 |
|
72 |
# User-provided prompt
|
73 |
if prompt := st.chat_input():
|
|
|
74 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
75 |
with st.chat_message("user"):
|
76 |
st.write(prompt)
|
|
|
89 |
st.session_state.messages.append(message)
|
90 |
|
91 |
if __name__ == "__main__":
|
92 |
+
launch_bot()
|
93 |
+
|