SandraCLV commited on
Commit
c1a321e
·
1 Parent(s): f6c8ed8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -19
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
- transcriber = pipeline(model="openai/whisper-large-v2",device_map="auto")
10
- # checkpoint = "/innev/open-ai/huggingface/openai/whisper-base"
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
- #with gr.Blocks() as demo:
29
- # gr.Markdown("Start typing below and then click **Run** to see the output.")
30
- # with gr.Row():
31
- # inp = gr.Image()
32
- # out = gr.Textbox(placeholder=image_to_text(inp))
33
- # gr.Interface(fn=image_to_text, inputs=inp, outputs=out,interpretation="default")
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()