skyvera commited on
Commit
89b7458
verified
1 Parent(s): 3592cf3

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +48 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+
4
+ def make_api_call(authorization_key, prompt, phone_number):
5
+ headers = {
6
+ 'Authorization': authorization_key
7
+ }
8
+
9
+ data = {
10
+ "phone_number": phone_number,
11
+ "from": None,
12
+ "task": prompt,
13
+ "model": "enhanced",
14
+ "language": "eng",
15
+ "voice": "maya",
16
+ "voice_settings": {},
17
+ "local_dialing": False,
18
+ "max_duration": 12,
19
+ "answered_by_enabled": False,
20
+ "wait_for_greeting": False,
21
+ "record": False,
22
+ "amd": False,
23
+ "interruption_threshold": 100,
24
+ "temperature": None,
25
+ "transfer_list": {},
26
+ "metadata": {},
27
+ "pronunciation_guide": [],
28
+ "start_time": None,
29
+ "request_data": {},
30
+ "tools": [],
31
+ "webhook": None
32
+ }
33
+
34
+ response = requests.post('https://api.bland.ai/v1/calls', json=data, headers=headers)
35
+ return response.json()
36
+
37
+ interface = gr.Interface(
38
+ fn=make_api_call,
39
+ inputs=[
40
+ gr.Textbox(label="API Key", placeholder="Enter your API Key, e.g., sk-n 路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路"),
41
+ gr.Textbox(label="Task", lines=4, placeholder="Describe the task for the chat agent"),
42
+ gr.Textbox(label="Phone Number", placeholder="Enter phone number in international format, e.g., +1234567890")
43
+ ],
44
+ outputs="json",
45
+ description="Create your bland.ai account if you don't have one yet through [this link](https://app.bland.ai/signup). After creating your account, you can find your API key under the 'API Key' tab in your dashboard settings [here](https://app.bland.ai/dashboard?page=settings)."
46
+ )
47
+
48
+ interface.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ requests