model
Browse files- src/streamlit_app.py +3 -3
src/streamlit_app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import torch
|
| 3 |
import time
|
| 4 |
-
from transformers import
|
| 5 |
|
| 6 |
st.set_page_config(page_title="Question Generation", layout="wide")
|
| 7 |
|
|
@@ -71,8 +71,8 @@ def preprocess_function(examples, tokenizer):
|
|
| 71 |
return {key: tensor.to(device) for key, tensor in inputs.items()}
|
| 72 |
|
| 73 |
def generate_q(context, answer):
|
| 74 |
-
tokenizer =
|
| 75 |
-
model =
|
| 76 |
instruction_qg = 'Hãy tạo ra câu hỏi từ nội dung của ngữ cảnh và câu trả lời dưới đây.',
|
| 77 |
examples = {"input_seq": str("### Instruction: \n"
|
| 78 |
f"{instruction_qg} \n\n"
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import torch
|
| 3 |
import time
|
| 4 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 5 |
|
| 6 |
st.set_page_config(page_title="Question Generation", layout="wide")
|
| 7 |
|
|
|
|
| 71 |
return {key: tensor.to(device) for key, tensor in inputs.items()}
|
| 72 |
|
| 73 |
def generate_q(context, answer):
|
| 74 |
+
tokenizer = AutoTokenizer.from_pretrained('shnl/inst-qg-vinewsqa-vit5')
|
| 75 |
+
model = AutoModelForSeq2SeqLM.from_pretrained('shnl/inst-qg-vinewsqa-vit5')
|
| 76 |
instruction_qg = 'Hãy tạo ra câu hỏi từ nội dung của ngữ cảnh và câu trả lời dưới đây.',
|
| 77 |
examples = {"input_seq": str("### Instruction: \n"
|
| 78 |
f"{instruction_qg} \n\n"
|