BenDaouda commited on
Commit
1f855d9
1 Parent(s): 634b495

Create first version of app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import sounddevice as sd
3
+ import soundfile as sf
4
+ import gradio as gr
5
+
6
+
7
+ API_URL = "https://api-inference.huggingface.co/models/BenDaouda/wav2vec2-large-xls-r-300m-wolof-test-coloab"
8
+ headers = {"Authorization": "Bearer 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"}
9
+
10
+ def query(filename):
11
+ with open(filename, "rb") as f:
12
+ data = f.read()
13
+ response = requests.post(API_URL, headers=headers, data=data)
14
+ return response.json()
15
+
16
+
17
+ iface = gr.Interface(fn=query,inputs=gr.Audio(source="microphone", type="filepath"),output="text")
18
+
19
+ iface.launch()