Pengyu-gis commited on
Commit
b00aa6a
1 Parent(s): 5bf19a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -4
app.py CHANGED
@@ -1,5 +1,26 @@
1
- !git clone https://github.com/NExT-ChatV/NExT-Chat.git
2
- %cd NExT-Chat
3
- !pip install -r requirements.txt
4
 
5
- !CUDA_VISIBLE_DEVICES="0" python web_demo.py --model_path AoZhang/nextchat-7b-336 --vit_path openai/clip-vit-large-patch14-336
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
 
3
 
4
+ # Set the CUDA_VISIBLE_DEVICES environment variable
5
+ os.environ["CUDA_VISIBLE_DEVICES"] = "0"
6
+
7
+ # Import the demo script
8
+ from mllm.demo.web_demo import NextChatInference
9
+
10
+ # Initialize the model
11
+ model_path = "AoZhang/nextchat-7b-336"
12
+ vit_path = "openai/clip-vit-large-patch14-336"
13
+ model = NextChatInference(model_path, vit_path, 576)
14
+
15
+ # Gradio Interface
16
+ iface = gr.Interface(
17
+ fn=model,
18
+ inputs=["text", "image"],
19
+ outputs=["text", "image"],
20
+ live=True,
21
+ capture_session=True,
22
+ interpretation="default",
23
+ )
24
+
25
+ # Launch the interface
26
+ iface.launch()