Vision
Analyzeandinterpretimagesandvideosusingourcomputervisionmodels.
No conversations yet. Please start the conversation!
HowtoUseVisionModel?
LearnhowtoleveragetheVisionModelusingAPItotailorinstantmessagingfunctionalitiestofityourrequirements.
JavaScript (Request Format):
1async function sendRequestToAnalyzeImage(event) {
2 event.preventDefault();
3 const prompt = document.getElementById("prompt").value;
4 const fileInput = document.getElementById("imageFile");
5
6 if (fileInput.files.length === 0) {
7 document.getElementById("output").innerHTML = "Please select an image file.";
8 return;
9 }
10
11 const formData = new FormData();
12 formData.append("prompt", prompt);
13 formData.append("api_key", "mulmodel_api_key");
14 formData.append("file", fileInput.files[0]);
15 formData.append("model_type", "vision");
16
17 const response = await fetch("https://wxm-back.vercel.app//request_analyze_image", {
18 method: "POST",
19 body: formData,
20 });
21
22 const result = await response.json();
23 document.getElementById("output").innerHTML = result.text;
24}HTML (Structure Example):
1<h1>Image Analyze Request</h1>
2<form id="analyzeForm" enctype="multipart/form-data" onsubmit="sendRequestToAnalyzeImage(event)">
3 <label for="prompt">Prompt:</label>
4 <input type="text" id="prompt" name="prompt" value="Process this image"><br><br>
5
6 <label for="imageFile">Select Image:</label>
7 <input type="file" id="imageFile" name="file" accept="image/*" required><br><br>
8
9 <button type="submit">Analyze Image</button>
10</form>
11
12<span id="output"></span>JSON (Response Format):
1{
2 "text": "Text Generated By Vision Model on Valid API Key"
3}CURL (API Testing):
1curl -X POST "https://wxm-back.vercel.app//request_analyze_image" -F "api_key=your_api_key" -F "prompt=Describe the image" -F "model_type=vision" -F "file=@/path/to/your/image.jpg"