API
If you're looking for an API, you can choose from your desired programming language.
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
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
# Use this function to convert a list of image URLs to base64
def image_urls_to_base64(image_urls):
return [image_url_to_base64(url) for url in image_urls]
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/lyria-2"
# Request payload
data = {
"prompt": "Melodious guitar with gentle rain background.",
"negative_prompt": "No loud drums, no vocals."
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Attributes
Directs audio creation with a detailed theme; guides tone and mood. Example: 'Melodious guitar with gentle rain background.'
Ensures audio consistency across generations. Use '123' for repeated serene outputs, or omit for surprise variations.
Excludes specific unwanted elements from the audio. Use 'No loud drums' for softer compositions, 'No vocals' for instrumentals.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Discovering the Potential of Lyria 2 in Music Generation
Lyria 2, Google DeepMind's latest AI music generation model, offers a groundbreaking approach to producing high-quality instrumental music using text prompts. This model serves as an exceptional resource for developers, creators, and executives aiming to embed AI-generated music into their projects and businesses.
Key Capabilities of Lyria 2
Lyria 2's capabilities are tailored for generating instrumental music at a professional 48kHz stereo audio sample rate, making it ideal for diverse applications such as music production, app development, and creative collaboration. By utilizing real-time music creation via Lyria RealTime, the model supports interactive features through WebSocket connections, facilitating on-the-fly musical composition and adjustments.
The model also allows for customization through negative prompting, BPM control, and seed parameter settings, enabling users to fine-tune outputs to meet specific creative needs. It also implements SynthID for audio watermarking, ensuring traceable and secure content.
Technical Specifications
- 30 seconds of 48kHz stereo audio output
- Professional-grade audio suitable for direct integration into commercial or creative projects
- Implements SynthID for secure audio watermarking
Genre Coverage
- Classical
- Jazz
- Pop
- Electronic
- Orchestral
- Various regional and fusion styles
Limitations
Current known limitations include:
- Restricted language support
- Limited genre diversity in specific musical styles
- Variable model performance across complex musical arrangements
Practical Applications
For creators, Lyria 2 provides tools for swift musical ideation, crafting background tracks for content, and developing prototypes. Developers can harness its power for interactive music applications, dynamic game soundtracks, and user-personalized musical experiences. Executives will appreciate its capacity to drive innovation in music-filled wellness applications and engage audiences through dynamic audio content.
Implementation Strategies
To maximize Lyria 2's potential, focus on detailed prompt engineering with specific expressions of mood, genre, and instrumentation. Leveraging Google Cloud's Vertex AI or the Gemini API grants access to Lyria 2's robust features, making integration straightforward for developers.
By understanding the model's strengths and constraints, users can effectively exploit its offerings, ensuring seamless incorporation into both creative and technical workflows. This positions Lyria 2 as a pivotal tool for advancing audio content innovation across various sectors.
Other Popular Models
sadtalker
Audio-based Lip Synchronization for Talking Head Video

faceswap-v2
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training

sdxl-inpaint
This model is capable of generating photo-realistic images given any text input, with the extra capability of inpainting the pictures by using a mask

codeformer
CodeFormer is a robust face restoration algorithm for old photos or AI-generated faces.
