Spaces:
Sleeping
Sleeping
File size: 2,041 Bytes
89b7458 25a0dbc 89b7458 25a0dbc 949b382 89b7458 25a0dbc 89b7458 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import gradio as gr
import requests
import logging
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def make_api_call(authorization_key, prompt, phone_number):
logging.info(f"Making API call with prompt: {prompt} and phone number: {phone_number}")
headers = {
'Authorization': authorization_key
}
data = {
"phone_number": phone_number,
"from": None,
"task": prompt,
"model": "enhanced",
"language": "eng",
"voice": "maya",
"voice_settings": {},
"local_dialing": False,
"max_duration": 12,
"answered_by_enabled": False,
"wait_for_greeting": False,
"record": False,
"amd": False,
"interruption_threshold": 100,
"temperature": None,
"transfer_list": {},
"metadata": {},
"pronunciation_guide": [],
"start_time": None,
"request_data": {},
"tools": [],
"webhook": None
}
response = requests.post('https://api.bland.ai/v1/calls', json=data, headers=headers)
logging.info(f"API call response: {response.json()}")
return response.json()
interface = gr.Interface(
fn=make_api_call,
inputs=[
gr.Textbox(label="API Key", placeholder="Enter your API Key, e.g., sk-n 路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路"),
gr.Textbox(label="Task", lines=4, placeholder="Describe the task for the chat agent"),
gr.Textbox(label="Phone Number", placeholder="Enter phone number in international format, e.g., +1234567890")
],
outputs="json",
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)."
)
interface.launch() |