File size: 624 Bytes
856e978
 
dbd58af
856e978
 
 
 
 
 
dbd58af
856e978
dbd58af
856e978
dbd58af
856e978
dbd58af
856e978
dbd58af
856e978
dbd58af
856e978
dbd58af
856e978
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import torch
import streamlit as st
from PIL import Image
from megatron import MegatronLM, download_pretrained_model
 
#@st.cache(allow_output_mutation=True) # this line is important! without it, the app will crash on first run after a restart. 
def load_model():
    model = MegatronLM.from_pretrained('google/megatron-lm-1b')    
    return model.cuda()

 

 

 

     #@st.cache(allow_output_mutation=True) # this line is important! without it, the app will crash on first run after a restart. 

     def load_image(filename):        

          image = Image.open(filename).convert("RGB")        

          return image