import streamlit as st from gradio_client import Client #connecting to the URL client = Client("https://3c6d10d84bae52d4c7.gradio.live/") st.title('Digital Ink') # Initialize chat history if "messages" not in st.session_state: st.session_state.messages = [] # Display chat messages from history for message in st.session_state.messages: with st.chat_message(message["role"]): st.markdown(message["content"]) # Function for generating responses def generate_response(message): st.session_state.messages.append({"role": "user", "content": message}) response = client.predict(message=message,api_name="/predict") st.session_state.messages.append({"role": "assistant", "content": response}) return response # User input with placeholder if prompt := st.chat_input("Create with Digital Ink.."): # Display user message in chat message container with st.chat_message("user"): st.markdown(prompt) # Generate and display assistant response in chat message container with st.chat_message("assistant"): response = generate_response(prompt) st.markdown(response)