Spaces:
Running
Running
Chatbot page change
#4
by
aaronmat1905
- opened
app.py
CHANGED
@@ -413,39 +413,15 @@ class LLaMAAssistant:
|
|
413 |
def render_chat():
|
414 |
st.header("π¬ Business AI Assistant")
|
415 |
|
416 |
-
#
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
for message in st.session_state.messages:
|
426 |
-
with st.chat_message(message["role"]):
|
427 |
-
st.markdown(message["content"])
|
428 |
-
|
429 |
-
# User input
|
430 |
-
if prompt := st.chat_input("Ask about your business..."):
|
431 |
-
# Add user message to chat history
|
432 |
-
st.session_state.messages.append({"role": "user", "content": prompt})
|
433 |
-
|
434 |
-
# Display user message
|
435 |
-
with st.chat_message("user"):
|
436 |
-
st.markdown(prompt)
|
437 |
-
|
438 |
-
# Generate AI response
|
439 |
-
with st.chat_message("assistant"):
|
440 |
-
with st.spinner("Generating response..."):
|
441 |
-
response = st.session_state.llama_assistant.generate_response(
|
442 |
-
prompt,
|
443 |
-
st.session_state.messages[:-1] # Exclude current message
|
444 |
-
)
|
445 |
-
st.markdown(response)
|
446 |
-
|
447 |
-
# Add assistant response to history
|
448 |
-
st.session_state.messages.append({"role": "assistant", "content": response})
|
449 |
|
450 |
# Replace the existing render_chat() function in your main.py with this implementation
|
451 |
def main():
|
|
|
413 |
def render_chat():
|
414 |
st.header("π¬ Business AI Assistant")
|
415 |
|
416 |
+
# Embed the Hugging Face Space iframe
|
417 |
+
st.write("""
|
418 |
+
<iframe
|
419 |
+
src="https://demoorganisation34-chatbot-for-prospira.hf.space"
|
420 |
+
frameborder="0"
|
421 |
+
width="850"
|
422 |
+
height="450"
|
423 |
+
></iframe>
|
424 |
+
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
|
426 |
# Replace the existing render_chat() function in your main.py with this implementation
|
427 |
def main():
|