File size: 591 Bytes
b00aa6a
 
5bf19a3
b00aa6a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import os

# Set the CUDA_VISIBLE_DEVICES environment variable
os.environ["CUDA_VISIBLE_DEVICES"] = "0"

# Import the demo script
from mllm.demo.web_demo import NextChatInference

# Initialize the model
model_path = "AoZhang/nextchat-7b-336"
vit_path = "openai/clip-vit-large-patch14-336"
model = NextChatInference(model_path, vit_path, 576)

# Gradio Interface
iface = gr.Interface(
    fn=model,
    inputs=["text", "image"],
    outputs=["text", "image"],
    live=True,
    capture_session=True,
    interpretation="default",
)

# Launch the interface
iface.launch()