File size: 413 Bytes
dcee3e6
18bc429
a2320ed
b0a2a59
 
 
 
 
 
5739b16
a2320ed
 
d1117d8
 
 
a2320ed
 
 
d1117d8
a2320ed
 
 
 
 
 
a7938b4
dcee3e6
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


import streamlit as st
import os
HF_TOKEN = os.getenv('HF_TOKEN')
from huggingface_hub import HfFolder
# Set the token using HfFolder (this persists the token)
HfFolder.save_token(HF_TOKEN)

import transformers
from transformers import pipeline

generator = pipeline(model="openai-community/gpt2")


text = st.text_area("your input")

if text:
    out = generator(text, do_sample=False)
    st.json(out)