File size: 884 Bytes
ace2c57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b43ae42
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st

st.title("Helpful Snippets")
st.markdown("Below are some helpful interactive snippets that I've found useful. Will add to these as I think of them.")

st.markdown("### Pip install from GitHub repo")

repo_id = st.text_input("Repo", "huggingface/transformers")
repo_owner, repo_name = repo_id.split("/")[-2:]
branch_name = st.text_input("Branch Name")
nb = st.checkbox("Installing in notebook?")
st.markdown(f"""
Now you can copy this into your {'notebook' if nb else 'terminal'} and run:
```
{"! " if nb else ""}pip install git+https://github.com/{repo_owner}/{repo_name}{"@" + branch_name if branch_name.strip() != "" else ""}
```
""")


st.markdown('---')

st.markdown("### Colab Badge from Link")

colab_url = st.text_input("Colab URL")
st.markdown(f"""
```
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)]({colab_url})
```
""")