File size: 3,583 Bytes
eb5ef66 7d217cd 2900dae 7d217cd 2900dae 7d217cd 2900dae 7d217cd 2900dae 7d217cd 2900dae 7d217cd eb5ef66 2900dae 7d217cd 2900dae 7d217cd eb5ef66 7d217cd 2900dae 7d217cd eb5ef66 7d217cd eb5ef66 |
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
{
"cells": [
{
"cell_type": "markdown",
"id": "e9eeb947",
"metadata": {},
"source": [
"# Test ElevenLabs API"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "8b55bb7a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Eleven Labs API Key: sk_d1...\n"
]
}
],
"source": [
"import os\n",
"ELEVENLABS_API_KEY = os.getenv(\"ELEVENLABS_API_KEY\")\n",
"print(f\"Eleven Labs API Key: {ELEVENLABS_API_KEY[0:5]}...\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5ba0c84e",
"metadata": {},
"outputs": [],
"source": [
"text = \"\"\"\n",
"Over the past decade, astronomers have discovered three mysterious objects traveling through our solar system that originated from beyond it—interstellar visitors named 'Oumuamua, Borisov, and ATLAS. A key question has been: where did these objects come from and when? This research tackles that puzzle by working backward through space and time, using the gravitational pull of our galaxy to trace each object's likely trajectory and determine which stars might have ejected them.\n",
"\n",
"The researchers used advanced computer simulations, running 10,000 different possible paths for each object to account for measurement uncertainties. They then employed a statistical framework inspired by Bayesian reasoning—essentially a method for updating beliefs based on evidence—combined with knowledge about how stars of different ages move in our galaxy. By measuring how far each object's orbit takes it above and below the galactic plane, they could estimate how old the star system was that originally launched it. Younger stars stay closer to the galactic plane, while older stars have been \"heated up\" by gravitational interactions over billions of years and venture farther away.\n",
"\n",
"The results reveal a clear pattern: 'Oumuamua came from a young star system about 1 billion years old, Borisov from a middle-aged system around 3.8 billion years old, and ATLAS from an ancient system roughly 9.6 billion years old. This research demonstrates a novel technique for investigating interstellar objects and hints at the diverse stellar populations throughout our galaxy that may be flinging objects into interstellar space.\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "99d19e18",
"metadata": {},
"outputs": [],
"source": [
"from elevenlabs.client import ElevenLabs\n",
"from elevenlabs.play import play\n",
"\n",
"client = ElevenLabs(\n",
" api_key=ELEVENLABS_API_KEY\n",
")\n",
"\n",
"audio = client.text_to_speech.convert(\n",
" text=text,\n",
" voice_id=\"JBFqnCBsd6RMkjVDRZzb\",\n",
" model_id=\"eleven_multilingual_v2\",\n",
" output_format=\"mp3_44100_128\",\n",
")\n",
"\n",
"play(audio)\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "ad8c93d3",
"metadata": {},
"outputs": [],
"source": [
"play(audio)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "science-storyteller",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.19"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|