webtoaudio / testGradioAPI.py
Brunwo
fixed api call , trying share pwa function
d09fd1e
raw
history blame contribute delete
767 Bytes
from gradio_client import Client
import os
client = Client("http://127.0.0.1:7860/")
from dotenv import load_dotenv
load_dotenv()
key = os.getenv("OPENAI_API_KEY")
if not key:
print("OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.")
exit(1)
print(f"Using OpenAI API key: {key}")
result = client.predict(
url="https://www.infoq.com/articles/ai-ml-data-engineering-trends-2024/",
# use_default_template="summary",
# use_default_template=True,
openai_api_key=key,
text_model="gpt-4o-mini",
audio_model="tts-1",
speaker_1_voice="alloy",
speaker_2_voice="echo",
api_base=None,
edited_transcript="",
user_feedback="",
api_name="/generate_audio"
,original_text="summary"
)
print(result)