Ayush239 commited on
Commit
d327678
·
verified ·
1 Parent(s): d8c6424

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -15
app.py CHANGED
@@ -74,11 +74,9 @@ class Me:
74
  self.summary = ""
75
  self.linkedin = ""
76
 
77
- # Load summary
78
  if os.path.exists("me/summary.txt"):
79
  self.summary = open("me/summary.txt", "r", encoding="utf-8").read()
80
 
81
- # Load LinkedIn PDF text
82
  pdf_path = "me/Ayush_linkdin.pdf"
83
  if os.path.exists(pdf_path):
84
  text = []
@@ -133,10 +131,7 @@ LinkedIn:
133
  fname = func.name
134
  args = json.loads(func.arguments)
135
  result = globals()[fname](**args)
136
- messages.append({
137
- "role": "tool",
138
- "content": json.dumps(result)
139
- })
140
  continue
141
 
142
  return msg.content
@@ -167,7 +162,6 @@ with gr.Blocks(css="""
167
  background-color: #ff1a8c !important;
168
  }
169
 
170
- /* Chatbot background image */
171
  #chatbot {
172
  background: url('bg_desktop.jpg') no-repeat center;
173
  background-size: cover;
@@ -175,7 +169,6 @@ with gr.Blocks(css="""
175
  padding: 10px;
176
  }
177
 
178
- /* Mobile-friendly scaling */
179
  @media (max-width: 600px) {
180
  #chatbot {
181
  background-size: contain;
@@ -187,17 +180,20 @@ with gr.Blocks(css="""
187
  chatbot = gr.Chatbot(type="messages", height=420, elem_id="chatbot")
188
 
189
  with gr.Row():
190
- gr.Button("Who are you?").click(lambda: "Who are you?", None, "user_input")
191
- gr.Button("Contact Info").click(lambda: "What is Ayush Tyagi's contact information?", None, "user_input")
192
- gr.Button("Latest Projects").click(lambda: "Show Ayush Tyagi’s latest projects.", None, "user_input")
193
 
194
  with gr.Row():
195
- user_input = gr.Textbox(
196
- placeholder="Type your message...",
197
- scale=8
198
- )
199
  send_btn = gr.Button("Send", scale=1)
200
 
 
 
 
 
 
 
201
  user_input.submit(respond, [user_input, chatbot], [user_input, chatbot])
202
  send_btn.click(respond, [user_input, chatbot], [user_input, chatbot])
203
 
 
74
  self.summary = ""
75
  self.linkedin = ""
76
 
 
77
  if os.path.exists("me/summary.txt"):
78
  self.summary = open("me/summary.txt", "r", encoding="utf-8").read()
79
 
 
80
  pdf_path = "me/Ayush_linkdin.pdf"
81
  if os.path.exists(pdf_path):
82
  text = []
 
131
  fname = func.name
132
  args = json.loads(func.arguments)
133
  result = globals()[fname](**args)
134
+ messages.append({"role": "tool", "content": json.dumps(result)})
 
 
 
135
  continue
136
 
137
  return msg.content
 
162
  background-color: #ff1a8c !important;
163
  }
164
 
 
165
  #chatbot {
166
  background: url('bg_desktop.jpg') no-repeat center;
167
  background-size: cover;
 
169
  padding: 10px;
170
  }
171
 
 
172
  @media (max-width: 600px) {
173
  #chatbot {
174
  background-size: contain;
 
180
  chatbot = gr.Chatbot(type="messages", height=420, elem_id="chatbot")
181
 
182
  with gr.Row():
183
+ btn_about = gr.Button("Who are you?")
184
+ btn_contact = gr.Button("Contact Info")
185
+ btn_projects = gr.Button("Latest Projects")
186
 
187
  with gr.Row():
188
+ user_input = gr.Textbox(placeholder="Type your message...", scale=8)
 
 
 
189
  send_btn = gr.Button("Send", scale=1)
190
 
191
+ # Button → fill textbox
192
+ btn_about.click(lambda: "Who are you?", None, user_input)
193
+ btn_contact.click(lambda: "What is Ayush Tyagi's contact information?", None, user_input)
194
+ btn_projects.click(lambda: "Show Ayush Tyagi’s latest projects.", None, user_input)
195
+
196
+ # Submit message
197
  user_input.submit(respond, [user_input, chatbot], [user_input, chatbot])
198
  send_btn.click(respond, [user_input, chatbot], [user_input, chatbot])
199