File size: 940 Bytes
7aa5317
741cc94
7aa5317
 
741cc94
7aa5317
 
aed9794
7aa5317
741cc94
7aa5317
 
741cc94
 
7aa5317
741cc94
7aa5317
 
741cc94
 
 
 
91db62e
aed9794
5e97fbe
741cc94
 
3b1917e
741cc94
aed9794
7aa5317
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# app.py(主入口简化版)
import gradio as gr
from src.model_loader import load_model
from src.video_utils import process_video_for_internvl3

# === 初始化模型 ===
tokenizer, model = load_model()

# === 推理接口 ===
def evaluate_ar(video):
    pixel_values, num_patches_list, prompt = process_video_for_internvl3(video)
    generation_config = dict(max_new_tokens=512)
    output, _ = model.chat(
        tokenizer,
        pixel_values,
        prompt,
        generation_config=generation_config,
        num_patches_list=num_patches_list,
        history=None,
        return_history=True
    )
    return output

# === Gradio 接口 ===
gr.Interface(
    fn=evaluate_ar,
    inputs=gr.Video(label="Upload your AR video"),
    outputs="text",
    title="InternVL3 AR Evaluation (Single-turn)",
    description="Upload a short AR video clip. The model will sample frames and assess occlusion/rendering quality."
).launch()