Improve prompts
This commit is contained in:
parent
fe323e38b5
commit
f6cc5d380f
1 changed files with 5 additions and 49 deletions
|
|
@ -61,52 +61,8 @@ pub struct Thumbnail {
|
|||
pub time: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct GeminiRequest {
|
||||
contents: GeminiContent,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct GeminiContent {
|
||||
parts: Vec<GeminiPart>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct GeminiPart {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
text: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
inline_data: Option<ImageData>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct ImageData {
|
||||
mime_type: String,
|
||||
data: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
enum GeminiResponse {
|
||||
Success {
|
||||
candidates: Vec<GeminiCandidate>,
|
||||
},
|
||||
Error {
|
||||
error: GeminiError,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct GeminiError {
|
||||
code: i32,
|
||||
message: String,
|
||||
status: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct GeminiCandidate {
|
||||
content: GeminiContent,
|
||||
}
|
||||
// Note: Removed unused Gemini request/response structs since we're handling
|
||||
// the API interaction through the Python script
|
||||
|
||||
#[derive(Debug, Serialize, Clone)]
|
||||
pub struct ProgressUpdate {
|
||||
|
|
@ -297,10 +253,10 @@ pub async fn process_transcription_impl(args: TranscriptionArgs) -> Result<Trans
|
|||
2. The people present, their appearance, and positioning
|
||||
3. Any relevant visual context or background details
|
||||
|
||||
Format the description in clear, concise paragraphs that would be helpful for DeafBlind readers to understand the visual context. Focus on spatial relationships and important visual details that contribute to understanding the scene. Use maximum of 200 words.";
|
||||
Format the description in clear, concise paragraphs that would be helpful for DeafBlind readers to understand the visual context. Focus on spatial relationships and important visual details that contribute to understanding the scene. Use maximum of 200 words and do not include your own thoughts-- just provide the visual description alone.";
|
||||
|
||||
let subtitle_prompt = format!("Convert the following subtitle content into a natural, flowing narrative that includes:
|
||||
1. Speaker identification when there are multiple speakers
|
||||
1. Speaker identification when there are multiple speakers and if there is a single speaker, no need to provide speaker identification.
|
||||
2. Speaking manner and tone where relevant (e.g., \"warmly\", \"enthusiastically\")
|
||||
3. Clear paragraph breaks between different speakers or topics
|
||||
4. Natural transition words to connect dialogue
|
||||
|
|
@ -309,7 +265,7 @@ Format the description in clear, concise paragraphs that would be helpful for De
|
|||
Subtitle content:
|
||||
{}
|
||||
|
||||
Format the text as a professional transcript, maintaining chronological flow while making it read naturally.", subtitle_content);
|
||||
Format the text as a professional transcript, maintaining chronological flow while making it read naturally. I want you to just provide the visual description alone.", subtitle_content);
|
||||
|
||||
let (visual_description, subtitle_narrative) = tokio::join!(
|
||||
query_gemini(&args.api_key, visual_prompt, Some(frame_path.to_str().unwrap())),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue