Skip to content

Commit f3dbcb5

Browse files
committed
chore: add suggestions from code review
1 parent 55c912f commit f3dbcb5

14 files changed

Lines changed: 44 additions & 15 deletions

File tree

apps/computer-vision/app/classification/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default function ClassificationScreen() {
3030
if (typeof uri === 'string') {
3131
setImageUri(uri as string);
3232
setResults([]);
33+
setInferenceTime(null);
3334
}
3435
};
3536

apps/computer-vision/app/object_detection/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default function ObjectDetectionScreen() {
4848
setImageUri(image.uri as string);
4949
setImageDimensions({ width: width as number, height: height as number });
5050
setResults([]);
51+
setInferenceTime(null);
5152
}
5253
};
5354

apps/computer-vision/app/ocr/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export default function OCRScreen() {
6060
if (typeof uri === 'string') {
6161
setImageUri(uri as string);
6262
setResults([]);
63+
setInferenceTime(null);
6364
}
6465
};
6566

apps/computer-vision/app/ocr_vertical/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default function VerticalOCRScree() {
3535
if (typeof uri === 'string') {
3636
setImageUri(uri as string);
3737
setResults([]);
38+
setInferenceTime(null);
3839
}
3940
};
4041

apps/computer-vision/app/semantic_segmentation/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export default function SemanticSegmentationScreen() {
8888
setImageUri(image.uri);
8989
setImageSize({ width: image.width ?? 0, height: image.height ?? 0 });
9090
setSegImage(null);
91+
setInferenceTime(null);
9192
};
9293

9394
const runForward = async () => {

apps/computer-vision/app/style_transfer/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default function StyleTransferScreen() {
5151
if (typeof uri === 'string') {
5252
setImageUri(uri);
5353
setStyledUri('');
54+
setInferenceTime(null);
5455
}
5556
};
5657

apps/llm/app/llm/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ function LLMScreen() {
4646
const { setGlobalGenerating } = useContext(GeneratingContext);
4747

4848
const llm = useLLM({ model: selectedModel });
49-
const { stats, onMessageSend } = useLLMStats(llm.response, llm.isGenerating);
49+
const tokenCount = llm.isReady ? llm.getGeneratedTokenCount() : 0;
50+
const { stats, onMessageSend } = useLLMStats(
51+
llm.response,
52+
llm.isGenerating,
53+
tokenCount
54+
);
5055

5156
useEffect(() => {
5257
if (llm.error) {

apps/llm/app/llm_structured_output/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ function LLMScreen() {
8888
const { setGlobalGenerating } = useContext(GeneratingContext);
8989

9090
const llm = useLLM({ model: selectedModel });
91-
const { stats, onMessageSend } = useLLMStats(llm.response, llm.isGenerating);
91+
const tokenCount = llm.isReady ? llm.getGeneratedTokenCount() : 0;
92+
const { stats, onMessageSend } = useLLMStats(
93+
llm.response,
94+
llm.isGenerating,
95+
tokenCount
96+
);
9297

9398
useEffect(() => {
9499
setGlobalGenerating(llm.isGenerating);

apps/llm/app/llm_tool_calling/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ function LLMToolCallingScreen() {
6060
const { setGlobalGenerating } = useContext(GeneratingContext);
6161

6262
const llm = useLLM({ model: selectedModel });
63-
const { stats, onMessageSend } = useLLMStats(llm.response, llm.isGenerating);
63+
const tokenCount = llm.isReady ? llm.getGeneratedTokenCount() : 0;
64+
const { stats, onMessageSend } = useLLMStats(
65+
llm.response,
66+
llm.isGenerating,
67+
tokenCount
68+
);
6469

6570
useEffect(() => {
6671
setGlobalGenerating(llm.isGenerating);

apps/llm/app/multimodal_llm/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ function MultimodalLLMScreen() {
4646
const vlm = useLLM({
4747
model: LFM2_VL_1_6B_QUANTIZED,
4848
});
49-
const { stats, onMessageSend } = useLLMStats(vlm.response, vlm.isGenerating);
49+
const tokenCount = vlm.isReady ? vlm.getGeneratedTokenCount() : 0;
50+
const { stats, onMessageSend } = useLLMStats(
51+
vlm.response,
52+
vlm.isGenerating,
53+
tokenCount
54+
);
5055

5156
useEffect(() => {
5257
setGlobalGenerating(vlm.isGenerating);

0 commit comments

Comments
 (0)