Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,18 +6,9 @@ import datasets
|
|
6 |
from transformers.pipelines.pt_utils import KeyDataset
|
7 |
from tqdm.auto import tqdm
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
image_to_text_model = pipeline("image-classification")
|
12 |
-
text_to_audio_model = pipeline("text-to-speech")
|
13 |
-
pipe_audio = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h", device=0)
|
14 |
-
dataset = datasets.load_dataset("superb", name="asr", split="test")
|
15 |
|
16 |
-
for out in tqdm(pipe(KeyDataset(dataset, "file"))):
|
17 |
-
print(out)
|
18 |
-
# {"text": "NUMBER TEN FRESH NELLY IS WAITING ON YOU GOOD NIGHT HUSBAND"}
|
19 |
-
# {"text": ....}
|
20 |
-
# ....
|
21 |
def image_to_text(input_image):
|
22 |
# Convertir la imagen a texto
|
23 |
text_output = image_to_text_model(input_image)[0]['label']
|
@@ -25,11 +16,9 @@ def image_to_text(input_image):
|
|
25 |
#texts = transcriber(text_output)
|
26 |
return text_output
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
#demo.launch()
|
|
|
6 |
from transformers.pipelines.pt_utils import KeyDataset
|
7 |
from tqdm.auto import tqdm
|
8 |
|
9 |
+
image_to_text_model = pipeline("image-classification",model="microsoft/beit-base-patch16-224-pt22k-ft22k")
|
10 |
+
|
|
|
|
|
|
|
|
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
def image_to_text(input_image):
|
13 |
# Convertir la imagen a texto
|
14 |
text_output = image_to_text_model(input_image)[0]['label']
|
|
|
16 |
#texts = transcriber(text_output)
|
17 |
return text_output
|
18 |
|
19 |
+
gr.Interface.from_pipeline(pipe,
|
20 |
+
title="22k Image Classification",
|
21 |
+
description="Object Recognition using Microsoft BEIT",
|
22 |
+
examples = [],
|
23 |
+
article = "Author: <a href=\"https://huggingface.co/rowel\">Rowel Atienza</a>",
|
24 |
+
).launch()
|
|
|
|