Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Load your sign language detection model
|
| 5 |
model = pipeline("image-classification", model="RavenOnur/Sign-Language")
|
| 6 |
|
| 7 |
def classify_image(image):
|
|
|
|
|
|
|
| 8 |
results = model(image)
|
| 9 |
return {result['label']: result['score'] for result in results}
|
| 10 |
|
| 11 |
-
|
|
|
|
| 12 |
interface.launch(show_error=True)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import io
|
| 5 |
|
| 6 |
# Load your sign language detection model
|
| 7 |
model = pipeline("image-classification", model="RavenOnur/Sign-Language")
|
| 8 |
|
| 9 |
def classify_image(image):
|
| 10 |
+
# Ensure the image is in RGB format
|
| 11 |
+
image = image.convert("RGB")
|
| 12 |
results = model(image)
|
| 13 |
return {result['label']: result['score'] for result in results}
|
| 14 |
|
| 15 |
+
# Define the Gradio interface
|
| 16 |
+
interface = gr.Interface(fn=classify_image, inputs=gr.Image(type="pil"), outputs="label")
|
| 17 |
interface.launch(show_error=True)
|