Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jpgallegoar authored Oct 24, 2024
1 parent 52a682f commit 4d29f11
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gradio_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def gpu_decorator(func):
chat_model_state = None
chat_tokenizer_state = None


def generate_response(messages, model, tokenizer):
"""Generate response using Qwen"""
text = tokenizer.apply_chat_template(
Expand Down Expand Up @@ -532,7 +533,6 @@ def validate_speech_types(gen_text, regular_name, *args):
"""
)


load_chat_model_btn = gr.Button("Load Chat Model", variant="primary")

chat_interface_container = gr.Column(visible=False)
Expand All @@ -546,9 +546,8 @@ def load_chat_model():
chat_model_state = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
chat_tokenizer_state = AutoTokenizer.from_pretrained(model_name)
show_info("Chat model loaded.")

return gr.update(visible=False), gr.update(visible=True)

load_chat_model_btn.click(load_chat_model, outputs=[load_chat_model_btn, chat_interface_container])

with chat_interface_container:
Expand Down

0 comments on commit 4d29f11

Please sign in to comment.