Alic-Li commited on
Commit
2474e52
·
verified ·
1 Parent(s): 749dc43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -3,26 +3,21 @@ from infer.worldmodel import Worldinfer
3
  from PIL import Image
4
  from huggingface_hub import hf_hub_download, snapshot_download
5
  import re
 
6
  # 初始化模型
7
- llm_path = hf_hub_download(repo_id="WorldRWKV/RWKV7-0.4B-siglip2", repo_type="model", filename="rwkv-0.pth",local_dir="./")
8
- llm_path = "./rwkv-0"
9
  encoder_path = snapshot_download(repo_id="google/siglip2-base-patch16-384")
10
-
 
11
  encoder_type = 'siglip'
12
 
13
  # 全局变量存储当前上传的图片和模型状态
14
  current_image = None
15
  current_state = None
16
  first_question = False # 存储模型状态
17
- # 是否是第一轮对话
18
  # 初始化模型
19
  model = Worldinfer(model_path=llm_path, encoder_type=encoder_type, encoder_path=encoder_path)
20
 
21
- # 处理用户输入的核心逻辑
22
- import html # 导入html库
23
-
24
- import re
25
-
26
  # 处理用户输入的核心逻辑
27
  def chat_fn(user_input, chat_history, image=None):
28
  global current_image, current_state, first_question
@@ -197,4 +192,4 @@ with gr.Blocks(title="WORLD RWKV", theme=gr.themes.Soft()) as demo:
197
 
198
  # 启动应用
199
  if __name__ == "__main__":
200
- demo.launch()
 
3
  from PIL import Image
4
  from huggingface_hub import hf_hub_download, snapshot_download
5
  import re
6
+ import html
7
  # 初始化模型
8
+ llm_path = hf_hub_download(repo_id="WorldRWKV/RWKV7-0.4B-G1-SigLIP2-ColdStart",filename="rwkv-0.pth",local_dir="./model_weights/")
 
9
  encoder_path = snapshot_download(repo_id="google/siglip2-base-patch16-384")
10
+ # llm_path = "/mnt/B8E84E9EE84E5B30/rwkv-models/world_rwkv/world_weights/rwkv-0"
11
+ # encoder_path = "/mnt/B8E84E9EE84E5B30/rwkv-models/world_rwkv/siglip2-base-patch16-384/"
12
  encoder_type = 'siglip'
13
 
14
  # 全局变量存储当前上传的图片和模型状态
15
  current_image = None
16
  current_state = None
17
  first_question = False # 存储模型状态
 
18
  # 初始化模型
19
  model = Worldinfer(model_path=llm_path, encoder_type=encoder_type, encoder_path=encoder_path)
20
 
 
 
 
 
 
21
  # 处理用户输入的核心逻辑
22
  def chat_fn(user_input, chat_history, image=None):
23
  global current_image, current_state, first_question
 
192
 
193
  # 启动应用
194
  if __name__ == "__main__":
195
+ demo.launch(server_name="127.0.0.1", server_port=7860)