File size: 1,090 Bytes
fa0959d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import streamlit as st
class LiveBook:
    def __init__(self,url:str):
        github_link = url
        
        st.write("### Livebook")
        option_color = st.selectbox("Select Color : " , options = ['blue' , 'black' , 'gray' , 'pink'] , format_func = lambda option: {'blue':'Blue', 'black':'Black' , 'gray':'Gray' , "pink":"Pink"}.get(option))

        livebook_markdown = f'[![Run in Livebook](https://livebook.dev/badge/v1/{option_color}.svg)](https://livebook.dev/run?url={github_link})'
        livebook_html = f"""
        <a href="https://livebook.dev/run?url={github_link}">
        <img src="https://livebook.dev/badge/v1/{option_color}.svg" alt="Run in Livebook" />
        </a>
        """

        st.write("""
                **Note**: Elixir files Only
                """)

        # Showing Codes
        col1 , col2 = st.columns(2)
        with col1:
            st.write("**Markdown**")
            st.code(livebook_markdown)
            
        with col2:
            st.write("**HTML**")
            st.code(livebook_html)

        st.markdown(livebook_markdown)