Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,9 +34,9 @@ def is_offensive(text):
|
|
| 34 |
@st.cache_resource
|
| 35 |
def load_model():
|
| 36 |
"""Load the Hugging Face model and tokenizer."""
|
|
|
|
|
|
|
| 37 |
model_name = "mistralai/Mistral-7B-Instruct-v0.3" # Updated model name
|
| 38 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 39 |
-
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
|
| 40 |
hf_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, device=0 if device.type == "cuda" else -1)
|
| 41 |
return HuggingFacePipeline(pipeline=hf_pipeline)
|
| 42 |
|
|
|
|
| 34 |
@st.cache_resource
|
| 35 |
def load_model():
|
| 36 |
"""Load the Hugging Face model and tokenizer."""
|
| 37 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b")
|
| 38 |
+
model = AutoModelForCausalLM.from_pretrained("google/gemma-2b",device_map="auto")
|
| 39 |
model_name = "mistralai/Mistral-7B-Instruct-v0.3" # Updated model name
|
|
|
|
|
|
|
| 40 |
hf_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, device=0 if device.type == "cuda" else -1)
|
| 41 |
return HuggingFacePipeline(pipeline=hf_pipeline)
|
| 42 |
|