Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
-
from transformers import pipeline, T5ForConditionalGeneration
|
3 |
from peft import get_peft_model, LoraConfig
|
4 |
|
5 |
# Define the same LoRA configuration used during fine-tuning
|
@@ -11,11 +11,12 @@ lora_config = LoraConfig(
|
|
11 |
bias="none"
|
12 |
)
|
13 |
|
14 |
-
# Load the model from Hugging Face's hub
|
15 |
model = get_peft_model(T5ForConditionalGeneration.from_pretrained("danrdoran/flan-t5-simplified-squad"), lora_config)
|
|
|
16 |
|
17 |
# Set up the Hugging Face pipeline for text2text-generation task
|
18 |
-
model_pipeline = pipeline("text2text-generation", model=model)
|
19 |
|
20 |
# Streamlit app UI
|
21 |
st.title("AI English Tutor")
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import pipeline, T5ForConditionalGeneration, T5Tokenizer
|
3 |
from peft import get_peft_model, LoraConfig
|
4 |
|
5 |
# Define the same LoRA configuration used during fine-tuning
|
|
|
11 |
bias="none"
|
12 |
)
|
13 |
|
14 |
+
# Load the model and tokenizer from Hugging Face's hub
|
15 |
model = get_peft_model(T5ForConditionalGeneration.from_pretrained("danrdoran/flan-t5-simplified-squad"), lora_config)
|
16 |
+
tokenizer = T5Tokenizer.from_pretrained("danrdoran/flan-t5-simplified-squad")
|
17 |
|
18 |
# Set up the Hugging Face pipeline for text2text-generation task
|
19 |
+
model_pipeline = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
|
20 |
|
21 |
# Streamlit app UI
|
22 |
st.title("AI English Tutor")
|