taka-yamakoshi
commited on
Commit
•
efeee8a
1
Parent(s):
a4fb159
add app
Browse files
app.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import streamlit as st
|
3 |
+
import numpy as np
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import seaborn as sns
|
6 |
+
import torch
|
7 |
+
import torch.nn.functional as F
|
8 |
+
from transformers import AlbertTokenizer
|
9 |
+
import time
|
10 |
+
|
11 |
+
|
12 |
+
if __name__=='__main__':
|
13 |
+
|
14 |
+
# Config
|
15 |
+
max_width = 1500
|
16 |
+
padding_top = 0
|
17 |
+
padding_right = 2
|
18 |
+
padding_bottom = 0
|
19 |
+
padding_left = 2
|
20 |
+
|
21 |
+
define_margins = f"""
|
22 |
+
<style>
|
23 |
+
.appview-container .main .block-container{{
|
24 |
+
max-width: {max_width}px;
|
25 |
+
padding-top: {padding_top}rem;
|
26 |
+
padding-right: {padding_right}rem;
|
27 |
+
padding-left: {padding_left}rem;
|
28 |
+
padding-bottom: {padding_bottom}rem;
|
29 |
+
}}
|
30 |
+
</style>
|
31 |
+
"""
|
32 |
+
hide_table_row_index = """
|
33 |
+
<style>
|
34 |
+
tbody th {display:none}
|
35 |
+
.blank {display:none}
|
36 |
+
</style>
|
37 |
+
"""
|
38 |
+
st.markdown(define_margins, unsafe_allow_html=True)
|
39 |
+
st.markdown(hide_table_row_index, unsafe_allow_html=True)
|
40 |
+
|
41 |
+
from custom_modeling_albert_flax import CustomFlaxAlbertForMaskedLM
|
42 |
+
model = CustomFlaxAlbertForMaskedLM.from_pretrained('albert-base-v2')
|