Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -164,29 +164,9 @@ Have a conversation with an AI using your reference voice!
|
|
164 |
""")
|
165 |
|
166 |
if not USING_SPACES:
|
167 |
-
load_chat_model_btn = gr.Button("Load Chat Model", variant="primary")
|
168 |
chat_interface_container = gr.Column(visible=False)
|
169 |
|
170 |
-
|
171 |
-
def load_chat_model():
|
172 |
-
global chat_model_state, chat_tokenizer_state
|
173 |
-
if chat_model_state is None:
|
174 |
-
gr.Info("Loading chat model...")
|
175 |
-
model_name = "deepseek-ai/Janus-Pro-7B"
|
176 |
-
chat_model_state = AutoModelForCausalLM.from_pretrained(
|
177 |
-
model_name, device_map="auto"
|
178 |
-
)
|
179 |
-
chat_tokenizer_state = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
180 |
-
gr.Info("Chat model loaded.")
|
181 |
-
return gr.update(visible=False), gr.update(visible=True)
|
182 |
-
|
183 |
-
load_chat_model_btn.click(load_chat_model, outputs=[load_chat_model_btn, chat_interface_container])
|
184 |
-
else:
|
185 |
-
chat_interface_container = gr.Column()
|
186 |
-
model_name = "deepseek-ai/Janus-Pro-7B"
|
187 |
-
chat_model_state = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto", trust_remote_code=True)
|
188 |
-
chat_tokenizer_state = AutoTokenizer.from_pretrained(model_name)
|
189 |
-
|
190 |
with chat_interface_container:
|
191 |
with gr.Row():
|
192 |
with gr.Column():
|
|
|
164 |
""")
|
165 |
|
166 |
if not USING_SPACES:
|
|
|
167 |
chat_interface_container = gr.Column(visible=False)
|
168 |
|
169 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
with chat_interface_container:
|
171 |
with gr.Row():
|
172 |
with gr.Column():
|