Spaces:
Sleeping
Sleeping
Commit ·
496838f
1
Parent(s): ef8bdc1
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,23 @@
|
|
| 1 |
import torch
|
| 2 |
-
from transformers import pipeline
|
| 3 |
import streamlit as st
|
| 4 |
-
|
|
|
|
| 5 |
title="Text Generator"
|
| 6 |
|
| 7 |
-
pipe = pipeline("text-generation", model='EleutherAI/gpt-neo-2.7B', trust_remote_code=True)
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
def main():
|
| 10 |
st.title(title)
|
| 11 |
|
| 12 |
with st.form("questionaire"):
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
clicked = st.form_submit_button("Generate image")
|
| 15 |
if clicked:
|
| 16 |
-
result=
|
| 17 |
-
st.
|
| 18 |
if __name__=='__main__':
|
| 19 |
main()
|
|
|
|
| 1 |
import torch
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
+
from thai2transformers.preprocess import process_transformers
|
| 4 |
+
from transformers import pipeline,AutoTokenizer
|
| 5 |
title="Text Generator"
|
| 6 |
|
| 7 |
+
#pipe = pipeline("text-generation", model='EleutherAI/gpt-neo-2.7B', trust_remote_code=True)
|
| 8 |
+
thai_classifier = pipeline(task="fill-mask",
|
| 9 |
+
tokenizer=AutoTokenizer.from_pretrained("airesearch/wangchanberta-base-att-spm-uncased"),
|
| 10 |
+
model="airesearch/wangchanberta-base-att-spm-uncased")
|
| 11 |
def main():
|
| 12 |
st.title(title)
|
| 13 |
|
| 14 |
with st.form("questionaire"):
|
| 15 |
+
prompt1 = st.text_input("your text")
|
| 16 |
+
prompt2 = st.text_input("your text")
|
| 17 |
+
input_text = process_transformers(f"{prompt1}<mask>{prompt2}<pad>")
|
| 18 |
clicked = st.form_submit_button("Generate image")
|
| 19 |
if clicked:
|
| 20 |
+
result=thai_classifier(input_text)
|
| 21 |
+
st.json(results)
|
| 22 |
if __name__=='__main__':
|
| 23 |
main()
|