camanalo1 commited on
Commit
2c1a9a3
·
1 Parent(s): 69c26bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -19
app.py CHANGED
@@ -1,22 +1,11 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load the default speech recognition model pipeline from Hugging Face
5
- asr_pipeline = pipeline("automatic-speech-recognition")
6
-
7
- # Define a Gradio interface to listen to microphone input and display the transcribed text
8
- def transcribe_audio():
9
- # Listen to microphone input
10
- audio_input = gr.audio_input()
11
- # Transcribe speech
12
- transcription = asr_pipeline(audio_input)
13
- return transcription[0]["transcription"]
14
-
15
- # Define Gradio interface
16
- gr.Interface(
17
- fn=transcribe_audio,
18
- inputs=gr.inputs.Microphone(label="Speak into the microphone"),
19
- outputs="text",
20
- title="Speech-to-Text with Default Model",
21
- description="Speak into the microphone and see the text transcription.",
22
- ).launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ pipe = pipeline(task="image-classification",
5
+ # model that can do 22k-category classification
6
+ model="microsoft/beit-base-patch16-224-pt22k-ft22k")
7
+ gr.Interface.from_pipeline(pipe,
8
+ title="22k Image Classification",
9
+ description="Object Recognition using Microsoft BEIT",
10
+ examples = ['wonder_cat.jpg', 'aki_dog.jpg',],
11
+ allow_flagging="never").launch(inbrowser=True)