SatyamSinghal commited on
Commit
1e9f3ed
·
verified ·
1 Parent(s): 0567ace

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -5,7 +5,6 @@ import torch
5
  MODEL_ID = "SatyamSinghal/taskmind-1.1b-chat-lora"
6
  HF_TOKEN = os.getenv("HF_TOKEN")
7
 
8
- # Lazy globals — loaded on first request, not at startup
9
  pipe = None
10
 
11
  def load_model():
@@ -45,8 +44,11 @@ def respond(message, history):
45
  return f"❌ Model failed to load: {str(e)}"
46
 
47
  messages = []
48
- for item in history:
49
- messages.append({"role": item["role"], "content": item["content"]})
 
 
 
50
  messages.append({"role": "user", "content": message})
51
 
52
  result = pipe(
@@ -65,12 +67,11 @@ def respond(message, history):
65
 
66
  demo = gr.ChatInterface(
67
  fn=respond,
68
- type="messages",
69
  title="TaskMind Interface",
70
  description="Chat with the TaskMind LoRA model.",
71
  examples=[
72
  "Who are you?",
73
- "@Model fix the growstreams deck ASAP NO Delay",
74
  "done bhai, merged the PR",
75
  "login page 60% ho gaya",
76
  "getting 500 error on registration",
 
5
  MODEL_ID = "SatyamSinghal/taskmind-1.1b-chat-lora"
6
  HF_TOKEN = os.getenv("HF_TOKEN")
7
 
 
8
  pipe = None
9
 
10
  def load_model():
 
44
  return f"❌ Model failed to load: {str(e)}"
45
 
46
  messages = []
47
+ for user_msg, assistant_msg in history:
48
+ if user_msg:
49
+ messages.append({"role": "user", "content": user_msg})
50
+ if assistant_msg:
51
+ messages.append({"role": "assistant", "content": assistant_msg})
52
  messages.append({"role": "user", "content": message})
53
 
54
  result = pipe(
 
67
 
68
  demo = gr.ChatInterface(
69
  fn=respond,
 
70
  title="TaskMind Interface",
71
  description="Chat with the TaskMind LoRA model.",
72
  examples=[
73
  "Who are you?",
74
+ "@Agrim fix the growstreams deck ASAP NO Delay",
75
  "done bhai, merged the PR",
76
  "login page 60% ho gaya",
77
  "getting 500 error on registration",