Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,16 +3,16 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
|
3 |
import pandas as pd
|
4 |
import re
|
5 |
|
6 |
-
# Load the
|
7 |
@st.cache_resource
|
8 |
-
def
|
9 |
-
"""Load the
|
10 |
-
model_name = "
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
12 |
model = AutoModelForCausalLM.from_pretrained(model_name)
|
13 |
return pipeline("text-generation", model=model, tokenizer=tokenizer)
|
14 |
|
15 |
-
qa_pipeline =
|
16 |
|
17 |
# Load SOP Dataset
|
18 |
@st.cache_data
|
@@ -39,7 +39,7 @@ def find_best_context(question, dataset):
|
|
39 |
return best_context
|
40 |
|
41 |
# Streamlit UI
|
42 |
-
st.title("SOP Question Answering AI with
|
43 |
st.markdown("Ask any question about Standard Operating Procedures:")
|
44 |
|
45 |
# User input
|
|
|
3 |
import pandas as pd
|
4 |
import re
|
5 |
|
6 |
+
# Load the Falcon-7B-Instruct model and tokenizer
|
7 |
@st.cache_resource
|
8 |
+
def load_falcon_model():
|
9 |
+
"""Load the Falcon-7B-Instruct model and tokenizer."""
|
10 |
+
model_name = "tiiuae/falcon-7b-instruct" # Open model for instruction-based tasks
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
12 |
model = AutoModelForCausalLM.from_pretrained(model_name)
|
13 |
return pipeline("text-generation", model=model, tokenizer=tokenizer)
|
14 |
|
15 |
+
qa_pipeline = load_falcon_model()
|
16 |
|
17 |
# Load SOP Dataset
|
18 |
@st.cache_data
|
|
|
39 |
return best_context
|
40 |
|
41 |
# Streamlit UI
|
42 |
+
st.title("SOP Question Answering AI with Falcon")
|
43 |
st.markdown("Ask any question about Standard Operating Procedures:")
|
44 |
|
45 |
# User input
|