Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,8 +14,8 @@ st.set_page_config(page_title="Sign Language Translator", layout="wide")
|
|
| 14 |
# Load the ASL alphabet model from Hugging Face
|
| 15 |
@st.cache_resource
|
| 16 |
def load_asl_model():
|
| 17 |
-
processor = AutoImageProcessor.from_pretrained("
|
| 18 |
-
model = AutoModelForImageClassification.from_pretrained("
|
| 19 |
return processor, model
|
| 20 |
|
| 21 |
processor, model = load_asl_model()
|
|
@@ -27,7 +27,7 @@ def classify_asl(image):
|
|
| 27 |
outputs = model(**inputs)
|
| 28 |
prediction = torch.argmax(outputs.logits, dim=-1).item()
|
| 29 |
labels = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") # ASL alphabet labels
|
| 30 |
-
return labels[prediction
|
| 31 |
|
| 32 |
# Streamlit UI
|
| 33 |
def main():
|
|
|
|
| 14 |
# Load the ASL alphabet model from Hugging Face
|
| 15 |
@st.cache_resource
|
| 16 |
def load_asl_model():
|
| 17 |
+
processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
|
| 18 |
+
model = AutoModelForImageClassification.from_pretrained("google/vit-base-patch16-224")
|
| 19 |
return processor, model
|
| 20 |
|
| 21 |
processor, model = load_asl_model()
|
|
|
|
| 27 |
outputs = model(**inputs)
|
| 28 |
prediction = torch.argmax(outputs.logits, dim=-1).item()
|
| 29 |
labels = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") # ASL alphabet labels
|
| 30 |
+
return labels[prediction % len(labels)]
|
| 31 |
|
| 32 |
# Streamlit UI
|
| 33 |
def main():
|