So, as in the answer field we have the JSON of adaptive card, Now how can we have adaptive card itself to be displayed below it.
Code snippet:
txt = st.text_area('Please enter JSON of Adaptive card')
#txt = {"type":"AdaptiveCard","body":[{"type":"TextBlock","text":"Our product is scalable with no limitations on it. We do load and performance testing to make sure that our application is robust performance wise and supports multiple logins at the same time.","wrap":True,"size":"Medium"}],"$schema":"http://adaptivecards.io/schemas/adaptive-card.json","version":"1.2","speak":"Our product is scalable with no limitations on it. We do load and performance testing to make sure that our application is robust performance wise and supports multiple logins at the same time."}
#Below the JSON we want to show the adaptive card.
Cool, I remember using this in MS Bot Framework. I think the way forward would be to use the Adaptive Card JavaScript SDK in a Streamlit component, and one of the Python Adaptive Card libraries to generate the required schema and json data to send to the component.
You want the card rendered in the browser, you need javascript. From Streamlit you can use the components API to inject the javascript code in the page.
The Python SDKs (Google search) are used to create a json data payload to send to the JavaScript SDK for rendering. Itโs the latter that youโd need to host in a Streamlit component. The Python side of the Streamlit component would pass the json data + (optionally) JavaScript action handler scripts. As mentioned by @Goyo, the JavaScript side of the Streamlit component will then render the card and (optionally) execute the JavaScript action script or pass the action data back to Streamlit to handle.
You should be able to do all of this with a static HTML Streamlit component. If interested, see a tutorial I wrote here, specifically the section on โComponent Zeroโ.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking โAccept allโ, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.