chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# OpenAI API Configuration
|
||||
OPENAI_API_KEY=your-openai-api-key-here
|
||||
|
||||
# Whisper API Configuration (Optional)
|
||||
WHISPER_API_KEY=your-whisper-api-key-here
|
||||
|
||||
# Optional Configurations
|
||||
MAX_TOKENS=4000
|
||||
MODEL_NAME=gpt-4-1106-preview
|
||||
TEMPERATURE=0.7
|
||||
|
||||
# Speech Settings
|
||||
AUDIO_FORMAT=mp3
|
||||
SAMPLE_RATE=16000
|
||||
@@ -0,0 +1,31 @@
|
||||
# Speech Graph Example
|
||||
|
||||
This example demonstrates how to use Scrapegraph-ai for speech processing and analysis.
|
||||
|
||||
## Features
|
||||
|
||||
- Speech-to-text conversion
|
||||
- Audio processing
|
||||
- Text analysis
|
||||
- Sentiment analysis
|
||||
|
||||
## Setup
|
||||
|
||||
1. Install required dependencies
|
||||
2. Copy `.env.example` to `.env`
|
||||
3. Configure your API keys in the `.env` file
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
from scrapegraphai.graphs import SpeechGraph
|
||||
|
||||
graph = SpeechGraph()
|
||||
text = graph.process("audio_file.mp3")
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Required environment variables:
|
||||
- `OPENAI_API_KEY`: Your OpenAI API key
|
||||
- `WHISPER_API_KEY`: Your Whisper API key (optional)
|
||||
@@ -0,0 +1,56 @@
|
||||
"""
|
||||
Basic example of scraping pipeline using SpeechSummaryGraph
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from scrapegraphai.graphs import SpeechGraph
|
||||
from scrapegraphai.utils import prettify_exec_info
|
||||
|
||||
load_dotenv()
|
||||
|
||||
# ************************************************
|
||||
# Define audio output path
|
||||
# ************************************************
|
||||
|
||||
FILE_NAME = "website_summary.mp3"
|
||||
curr_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
output_path = os.path.join(curr_dir, FILE_NAME)
|
||||
|
||||
# ************************************************
|
||||
# Define the configuration for the graph
|
||||
# ************************************************
|
||||
|
||||
openai_key = os.getenv("OPENAI_API_KEY")
|
||||
|
||||
graph_config = {
|
||||
"llm": {
|
||||
"api_key": openai_key,
|
||||
"model": "openai/gpt-4o",
|
||||
"temperature": 0.7,
|
||||
},
|
||||
"tts_model": {"api_key": openai_key, "model": "tts-1", "voice": "alloy"},
|
||||
"output_path": output_path,
|
||||
}
|
||||
|
||||
# ************************************************
|
||||
# Create the SpeechGraph instance and run it
|
||||
# ************************************************
|
||||
|
||||
speech_graph = SpeechGraph(
|
||||
prompt="Make a detailed audio summary of the projects.",
|
||||
source="https://perinim.github.io/projects/",
|
||||
config=graph_config,
|
||||
)
|
||||
|
||||
result = speech_graph.run()
|
||||
print(result)
|
||||
|
||||
# ************************************************
|
||||
# Get graph execution info
|
||||
# ************************************************
|
||||
|
||||
graph_exec_info = speech_graph.get_execution_info()
|
||||
print(prettify_exec_info(graph_exec_info))
|
||||
Reference in New Issue
Block a user