Modfiededition commited on
Commit
bef7abc
1 Parent(s): 9509abb

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import transformers
3
+
4
+
5
+ from transformers import pipeline
6
+
7
+ # Replace this with your own checkpoint
8
+ model_checkpoint = "huggingface/models/t5-base-fine-tuned-on-jfleg"
9
+
10
+
11
+ @st.cache
12
+ def load_model(model_name):
13
+ translator= pipeline("text2text: generation", model=model_checkpoint)
14
+ return translator
15
+
16
+ translator= load_model(model_checkpoint)
17
+
18
+ default_value = "Write your text here!"
19
+ #prompts
20
+ st.title("Writing Assistant for you 🦄")
21
+
22
+ sent = st.text_area("Text", default_value, height = 275)
23
+ generated_sequences = translator(sent)
24
+
25
+ st.write(generated_sequences[-1])