Spaces:
Runtime error
Runtime error
import streamlit as st | |
import os | |
def read_markdown(path, folder="./About/"): | |
with open(os.path.join(folder, path)) as f: | |
return f.read() | |
def load_page(): | |
st.markdown(""" # T5 for Sentence Split in English """) | |
st.markdown(""" ### Sentence Split is task of dividing complex sentence in two simple sentences """) | |
st.markdown(""" ## Goal """) | |
st.markdown(""" To make best sentence split model available till now """) | |
st.markdown(""" ## How to use the Model """) | |
st.markdown(""" | |
```python | |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM | |
tokenizer = AutoTokenizer.from_pretrained("flax-community/t5-base-wikisplit") | |
model = AutoModelForSeq2SeqLM.from_pretrained("flax-community/t5-base-wikisplit") | |
complex_sentence = "This comedy drama is produced by Tidy , the company she co-founded in 2008 with her husband David Peet , who is managing director ." | |
sample_tokenized = tokenizer(complex_sentence, return_tensors="pt") | |
answer = model.generate(sample_tokenized['input_ids'], attention_mask = sample_tokenized['attention_mask'], max_length=256, num_beams=5) | |
gene_sentence = tokenizer.decode(answer[0], skip_special_tokens=True) | |
gene_sentence | |
\""" | |
Output: | |
This comedy drama is produced by Tidy. She co-founded Tidy in 2008 with her husband David Peet, who is managing director. | |
\""" | |
``` """) | |
st.markdown(read_markdown("datasets.md")) | |
st.markdown(read_markdown("applications.md")) | |
#st.markdown(read_markdown("baseline.md")) | |
st.markdown(""" ## Current Basline from [paper](https://arxiv.org/abs/1907.12461) """) | |
st.image('./images/baseline.png') | |
st.markdown(read_markdown("results.md")) | |
st.markdown(read_markdown("accomplishments.md")) | |
st.markdown(read_markdown("gitrepo.md")) | |
st.markdown(read_markdown("contributors.md")) | |
st.markdown(read_markdown("credits.md")) | |