2025年8月26日火曜日
GoogleのVirtual Try-On APIを呼び出すAPEXアプリケーションを作成する
2025年5月29日木曜日
Google MediaPipe Solutionsの手指のランドマーク検出とオブジェクト検出をAPEXアプリで実行する
参照しているGoogle MediaPipeソリューションガイドのリンクは以下です。
<div class="detectOnClick">
<img id="preview" src="&P1_URL." title="Click to get detection!"></img>
</div>
<p>Hold your hand in front of your webcam to get real-time hand landmarker detection.</br>Click <b>enable webcam</b> below and grant access to the webcam if prompted.</p>
<div id="liveView" class="videoView">
<button id="webcamButton" class="mdc-button mdc-button--raised">
<span class="mdc-button__ripple"></span>
<span class="mdc-button__label">ENABLE WEBCAM</span>
</button>
<div style="position: relative;">
<video id="webcam" style="position: abso" autoplay playsinline></video>
<canvas class="output_canvas" id="output_canvas" style="position: absolute; left: 0px; top: 0px;"></canvas>
</div>
</div>
import {
ObjectDetector,
FilesetResolver,
Detection,
ObjectDetectionResult
} from "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.2";
app.js:18 Uncaught SyntaxError: The requested module 'https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.2' does not provide an export named 'Detection' (at app.js:18:3)
FaceDetector
, ObjectDetector
, HandLandmarker
, etc. You don't directly interact with a generic "Detection" class. Instead, you use the specific task classes to perform detections.2025年5月22日木曜日
APEXアプリのページ上でGoogle AI EdgeのMediaPipe LLM Inference APIを呼び出す
実行環境はmacOSのChromeです。作業としては、ウェブ用LLM推論ガイドのクイックスタートを参照しています。
LLMに送信する文字列は、ページ・アイテムP1_INPUTに入力します。タイプはテキスト領域を選択します。セッション・ステートのデータ型はCLOB、ストレージはリクエストごと(メモリーのみ)を設定します。
<entry key="standalone.static.path">/opt/oracle/apex/images</entry>
このパスの下はURLから見ると/i/以下にあるファイルとして参照されます。そのため、(上記の例では/opt/oracle/apex/images以下に)ディレクトリmodelsを作成し、その下にgemma2-2b-it-gpu-int8.binを置きました。
const modelFileName = '/i/models/gemma2-2b-it-gpu-int8.bin'; /* Update the file name */
2025年4月10日木曜日
GoogleのA2Aのサンプルに含まれるCoderエージェントをOracle APEXから呼び出してみる
% git clone https://github.com/google/A2A
Cloning into 'A2A'...
remote: Enumerating objects: 320, done.
remote: Counting objects: 100% (90/90), done.
remote: Compressing objects: 100% (71/71), done.
remote: Total 320 (delta 31), reused 29 (delta 18), pack-reused 230 (from 2)
Receiving objects: 100% (320/320), 1.86 MiB | 20.21 MiB/s, done.
Resolving deltas: 100% (73/73), done.
%
cd A2A/samples/js
% cd A2A/samples/js
js %
README.mdに記載されてい内容を確認します。マークダウンなのでブラウザからA2A/samples/jsを参照します。
% npm install genkit
npm warn deprecated @types/handlebars@4.1.0: This is a stub types definition. handlebars provides its own type definitions, so you do not need this installed.
added 401 packages, and audited 402 packages in 9s
44 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
js %
js % npm run agents:coder
> a2a-samples-js@0.1.0 agents:coder
> npx tsx src/agents/coder/index.ts
[CoderAgent] Server started on http://localhost:41241
[CoderAgent] Press Ctrl+C to stop the server
A2A Server listening on port 41241 at path /
js % npm run a2a:cli
> a2a-samples-js@0.1.0 a2a:cli
> npx tsx src/cli.ts
A2A Terminal Client
Agent URL: http://localhost:41241
Attempting to fetch agent card from: http://localhost:41241/.well-known/agent.json
✓ Agent Card Found:
Name: Coder Agent
Description: An agent that generates code based on natural language instructions and streams file outputs.
Version: 0.0.1
Starting Task ID: fe3dd9e3-0bf2-4710-b2cb-b0032fafe427
Enter messages, or use '/new' to start a new task.
Coder Agent > You:
Coder Agent > You: に"Write a python function to calculate fibonacci numbers."を入力します。
Enter messages, or use '/new' to start a new task.
Coder Agent > You: Write a python function to calculate fibonacci numbers.
Sending...
Coder Agent [11:00:50]: ⏳ Status: working
Part 1: 📝 Text: Generating code...
Coder Agent > You:
Coder Agent [11:00:55]: 📄 Artifact Received: fibonacci.py (Index: 0)
Part 1: 📝 Text: # This file contains a function to calculate Fibonacci numbers iteratively.
def fibonacci(n: int) -> int:
"""
Calculates the nth Fibonacci number iteratively.
Args:
n: The position in the Fibonacci sequence (non-negative integer).
Returns:
The nth Fibonacci number. Returns 0 for n <= 0.
"""
if n <= 0:
return 0
elif n == 1:
return 1
else:
a, b = 0, 1
# Iterate n-1 times because we already have the first number (b=1 for n=1)
for _ in range(n - 1):
a, b = b, a + b
return b
# Example usage (optional):
# print(fibonacci(0)) # Output: 0
# print(fibonacci(1)) # Output: 1
# print(fibonacci(10)) # Output: 55
# print(fibonacci(20)) # Output: 6765
Coder Agent [11:00:55]: ✅ Status: completed
Part 1: 📝 Text: Generated files: fibonacci.py
SSE stream finished for method tasks/sendSubscribe.
--- End of response for this input ---
Coder Agent > You:
% npm run agents:coder
> a2a-samples-js@0.1.0 agents:coder
> npx tsx src/agents/coder/index.ts
[CoderAgent] Server started on http://localhost:41241
[CoderAgent] Server started on http://localhost:41241
[CoderAgent] Press Ctrl+C to stop the server
A2A Server listening on port 41241 at path /
[[Task 3262b5fd-c805-faa8-e063-0200590aca0e] Created new task and history.
[CoderAgent] Emitting completed file (index 0): fib
[CoderAgent] Emitting final file (index 1): fibonacci.py
[Task 3262b5fd-c807-faa8-e063-0200590aca0e] Created new task and history.
[CoderAgent] Emitting final file (index 0): fibonacci.py
[Task 3262b5fd-c80a-faa8-e063-0200590aca0e] Created new task and history.
[CoderAgent] Emitting final file (index 0): fibonacci.py