Spaces:
Runtime error
Runtime error
only images
Browse files
app.py
CHANGED
|
@@ -5,27 +5,9 @@ from PIL import Image, ImageDraw
|
|
| 5 |
from transformers import pipeline
|
| 6 |
from tempfile import NamedTemporaryFile
|
| 7 |
|
| 8 |
-
audiopipe = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3")
|
| 9 |
-
#imagepipe = pipeline("image-classification", model="Kaludi/food-category-classification-v2.0")
|
| 10 |
-
#imagepipe = pipeline("image-classification", model="nateraw/food")
|
| 11 |
imagepipe = pipeline("image-classification", model="flatmoon102/fruits_and_vegetables_image_classification")
|
| 12 |
detector = pipeline(model="google/owlvit-base-patch32", task="zero-shot-object-detection")
|
| 13 |
|
| 14 |
-
#processor = OwlViTProcessor.from_pretrained("google/owlvit-base-patch32")
|
| 15 |
-
#model = OwlViTForObjectDetection.from_pretrained("google/owlvit-base-patch32")
|
| 16 |
-
|
| 17 |
-
st.title('Upload an audio file for speech recognition')
|
| 18 |
-
|
| 19 |
-
uploaded_audio_file = st.file_uploader("Choose an audio file (wav)")
|
| 20 |
-
if uploaded_audio_file is not None:
|
| 21 |
-
with NamedTemporaryFile(suffix="wav") as temp:
|
| 22 |
-
temp.write(uploaded_audio_file.getvalue())
|
| 23 |
-
temp.seek(0)
|
| 24 |
-
result = audiopipe(temp.name)
|
| 25 |
-
st.write(result)
|
| 26 |
-
|
| 27 |
-
st.title('Upload an image file to classification (food)')
|
| 28 |
-
|
| 29 |
uploaded_image_file = st.file_uploader("Choose an image file")
|
| 30 |
if uploaded_image_file is not None:
|
| 31 |
with NamedTemporaryFile() as temp:
|
|
|
|
| 5 |
from transformers import pipeline
|
| 6 |
from tempfile import NamedTemporaryFile
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
imagepipe = pipeline("image-classification", model="flatmoon102/fruits_and_vegetables_image_classification")
|
| 9 |
detector = pipeline(model="google/owlvit-base-patch32", task="zero-shot-object-detection")
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
uploaded_image_file = st.file_uploader("Choose an image file")
|
| 12 |
if uploaded_image_file is not None:
|
| 13 |
with NamedTemporaryFile() as temp:
|