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o/chatbot_multimodal/run.ipynb for enhancement
|
2 |
+
|
3 |
+
import PIL.Image
|
4 |
+
import gradio as gr
|
5 |
+
import base64
|
6 |
+
import time
|
7 |
+
import os
|
8 |
+
import google.generativeai as genai
|
9 |
+
import requests
|
10 |
+
|
11 |
+
import pathlib
|
12 |
+
|
13 |
+
txt_model = genai.GenerativeModel('gemini-pro')
|
14 |
+
vis_model = genai.GenerativeModel('gemini-pro-vision')
|
15 |
+
|
16 |
+
txt_prompt_1 = """
|
17 |
+
请列出图片中的文字整理成下列表格内容。
|
18 |
+
|
19 |
+
** 乐意保十问十答
|
20 |
+
|
21 |
+
| 序号 | 问题 | 回答 |
|
22 |
+
|-----|--------------|------------------------------------------------------------------------------------------|--------------------------------------|
|
23 |
+
| 1 | 哪些患者可以使用乐意保 | 乐意保再中国获批的适应症是....|
|
24 |
+
|
25 |
+
"""
|
26 |
+
|
27 |
+
txt_display_1 = 'content of the letter: '
|
28 |
+
|
29 |
+
|
30 |
+
txt_prompt_quali = """
|
31 |
+
Follow the example to make a markdwon Quali Metrics based on the job description content which is provided hereafter. Please note:
|
32 |
+
|
33 |
+
-when filling in My Credentials, and Notes please make reference to the Resume Experience below
|
34 |
+
|
35 |
+
** Resume Experience
|
36 |
+
|
37 |
+
Technical Operator & Material Handler 2021.03 -2022.08
|
38 |
+
Acutus Medical, Inc., Carlsbad, California
|
39 |
+
Acutus is a NASDAQ-listed medical device manufacturer specializing in catheters, EP mappers, mapping consoles, and
|
40 |
+
related supplies. My job duties include:
|
41 |
+
-Daily Planning for CEA Assembly Lines Material Flow: Oversaw the flow of materials within CEA,
|
42 |
+
encompassing electronic parts, tubes, ablation tips, balloon crowns, needles, wires, bonding chemicals,
|
43 |
+
temperature-sensitive elements, gas tanks, tool kits, and MROs.
|
44 |
+
-Material Transfer Responsibilities: Involved in the picking and transfer of materials between locations.
|
45 |
+
Conducted examinations of UDI and checked validity before release, collaborating with the QA department on
|
46 |
+
Non-Conformance Reports (NCRs).
|
47 |
+
-Line Production Works & Microscopic Soldering Tasks: Assigned to assist in the soldering works for the
|
48 |
+
production lines of mapper-catheters. The assignment involves using a microscope for hand-soldering
|
49 |
+
connectors to the unit base.
|
50 |
+
-Warehousing and Inventory Duties: Engaged in the stocking of approximately 800 parts/components and
|
51 |
+
recorded data in the QAD Inventory system. Managed inventory cycle counts, conducted book-physical audit
|
52 |
+
counts, and took part in variance analyses.
|
53 |
+
-Disposition of HazMat/Scraps: Handled downstream NCR disposition (scrap, rework, return or disposition).
|
54 |
+
Disposed in-field HazWaste. Assisted ISO sterilization in CEA or CMA zone.
|
55 |
+
-Shipping and Receiving Support: Subbed in for receiving and shipping tasks. Receiving functions included
|
56 |
+
checking shipment documents, initiating QAD receipt, and notifying related parties for downstream processes.
|
57 |
+
Shipping involved using FedEx or UPS for domestic or international shipments.
|
58 |
+
-Process Improvements: revamped the Kanban system, and participated in a smart cam project (a tablet UDI
|
59 |
+
tags reader APP).
|
60 |
+
Function-specific Proficiencies:
|
61 |
+
● QMS 21 CFR (820 803) and ISO 13485
|
62 |
+
● cGMP, GLP and good documentation practices
|
63 |
+
● Nonconforming Material Reporting (NCMR)
|
64 |
+
● Corrective Action Preventive Action (CAPA)
|
65 |
+
● Unique Device Identification (UDI)
|
66 |
+
● OpenFDA surveillance/MAUDE (complaints, adverse events, and malfunctions)
|
67 |
+
● Stock-out Alert/Visualization
|
68 |
+
● QAD-ERP and ACSM initiatives (Azure Cloud Solutions for Manufacturing)
|
69 |
+
● Basic lab skills
|
70 |
+
|
71 |
+
Lab Assembly Specialist, Xenowise BioLab, Suzhou, China (2017-2019)
|
72 |
+
Worked closely with technicians and scientists to establish Patient-Derived Xenograft (PDX) models for drug screening,
|
73 |
+
CRO candidate screening, and other preclinical pilot-trial studies. My role centered around coordinating processes,
|
74 |
+
contributing to lab setup, SOP development, and equipment acquisition.
|
75 |
+
|
76 |
+
Trainer, Consultant (2000-2015)
|
77 |
+
Clients: Pfizer, Roche, AstraZeneca (Beijing and Shanghai)
|
78 |
+
Scope of Work: training courses, and strategy service. Also provide Web-Based Training (WBT) programs covering
|
79 |
+
regulatory compliance, foundational knowledge, product information, and job-specific skills.
|
80 |
+
Business Manager, Philogenesis, Inc. (1996-1999, Monrovia, California)
|
81 |
+
Spearheaded the development and execution of comprehensive marketing strategies to enhance awareness, drive
|
82 |
+
adoption, and increase market penetration of biomaterial-based blood vessels for Coronary Artery Bypass Grafting
|
83 |
+
(CABG) procedures.
|
84 |
+
|
85 |
+
General Manager, BioMax, Inc. (1993-1996, Monrovia, California)
|
86 |
+
Oversaw day-to-day operations of the company, focusing on expanding market presence for medical-grade
|
87 |
+
lyophilized hemostatic collagen patches.
|
88 |
+
|
89 |
+
|
90 |
+
** example Job Post
|
91 |
+
|
92 |
+
Fill tablet, bottle, desiccant and closure hoppers. Hand count product using counting trays.
|
93 |
+
Manufacturing responsibilities include de-inking product, tablet breaking, product placement into oversized capsules and capsule inspection.
|
94 |
+
Inspect bottles for misalign closures, print registration and missing print copy, inspect seal integrity of pouch, print registration and missing print copy, inspect blister units and place them into properly assigned card locations for multi-fill operations; inspect blister cavities for missing product, burnt product, holes in foil, print registration, missing print, crushed blisters and seal integrity.
|
95 |
+
Responsible for cleaning machine equipment and production rooms as stated in cleaning SOP’s (Standard Operating Procedure). Fill in all appropriate information in the cleaning logbooks as well as responsible for cleaning production rooms with three bucket sponge mop cleaning system which includes ceilings, walls and floors.
|
96 |
+
When working on look-alike products you are only allowed to work with your assigned product. Multi-fill projects require that employees do not touch or help out other employees that are assigned different products.
|
97 |
+
All clinical labels must be inspected and require a 100% accountability. Clinical labels can be either manually or automatically applied.
|
98 |
+
Sealed clinical cards must be inspected for missing copy, poor seal, smudges and dirt, misalign blister units and burnt product.
|
99 |
+
Inspection required for vials, ampoules and syringes utilizing black and white light boxes.
|
100 |
+
Cold storage packaging will also be required working with cold product both outside and inside refrigeration conditions.
|
101 |
+
Assembly work required which may include utilizing barcode scanning equipment and computers.
|
102 |
+
Other duties as assigned
|
103 |
+
|
104 |
+
** example Quali Metrics
|
105 |
+
|
106 |
+
| Seq | Tasks | Descriptions | My Credential | Note |
|
107 |
+
|-----|---------------|-----------------------------------------------------------------------------------------------|--------------------------------------|--------------------|
|
108 |
+
| 1 | Filling | Fill tablet, bottle, desiccant, and closure hoppers. Hand count product using counting trays. | 5+ years experience in picking and filling at medical device assembly line | |
|
109 |
+
| 2 | Manufacturing | De-ink product, tablet breaking, place product into oversized capsules, and inspect capsules. | 10+ years experience in Acutus and Xenowise assembly works | |
|
110 |
+
| 3 | Inspection | Inspect bottles, pouch seals, blister units, blister cavities, clinical labels, and sealed cards. | 2+ years experience in GMP facility maintenance | |
|
111 |
+
| 4 | Cleaning | Clean machine equipment, production rooms, and fill in cleaning logbooks. | 5+ years experience in ISO 13485 QA proficiency | |
|
112 |
+
| 5 | Specialist | Work exclusively with assigned product, inspect clinical labels, and utilize black and white light boxes. | 10+ years adaptive experience at new assignments and new training | |
|
113 |
+
| 6 | Assembly | Perform assembly work, utilize barcode scanning equipment, and computers. | 5+ years experience familiar with various assembly responsibilities | |
|
114 |
+
| 7 | Other | Cold storage packaging, working with cold products, and other duties as assigned. | Seasoned experience with abundant experience | |
|
115 |
+
|
116 |
+
below are content of Tasks and Descriptions:
|
117 |
+
|
118 |
+
"""
|
119 |
+
txt_display_quali = '--- '
|
120 |
+
|
121 |
+
import os
|
122 |
+
GOOGLE_API_KEY=os.getenv('GOOGLE_API_KEY')
|
123 |
+
genai.configure(api_key=GOOGLE_API_KEY)
|
124 |
+
SMS_URL =os.getenv('SMS_URL')
|
125 |
+
SMS_TOK =os.getenv('SMS_TOK')
|
126 |
+
|
127 |
+
sms_text ="..."
|
128 |
+
# Image to Base 64 Converter
|
129 |
+
def image_to_base64(image_path):
|
130 |
+
with open(image_path, 'rb') as img:
|
131 |
+
encoded_string = base64.b64encode(img.read())
|
132 |
+
return encoded_string.decode('utf-8')
|
133 |
+
|
134 |
+
|
135 |
+
# Function that takes User Inputs, generates Response and displays on Chat UI
|
136 |
+
|
137 |
+
def quali_response(job_text):
|
138 |
+
combined_text = txt_prompt_quali + ' '+ job_text
|
139 |
+
response = txt_model.generate_content(combined_text)
|
140 |
+
return response.text
|
141 |
+
|
142 |
+
# Function that takes User Inputs, generates Response and displays on Chat UI
|
143 |
+
def app1_response(img):
|
144 |
+
if not img:
|
145 |
+
response = txt_model.generate_content(txt_prompt_1)
|
146 |
+
return response
|
147 |
+
|
148 |
+
else:
|
149 |
+
img = PIL.Image.open(img)
|
150 |
+
response = vis_model.generate_content([txt_prompt_1,img])
|
151 |
+
return response.text
|
152 |
+
|
153 |
+
|
154 |
+
# SMS service ends in March 2024, to restore service @Sinch Simple Text
|
155 |
+
def send_SMS(resp_text):
|
156 |
+
url = SMS_URL
|
157 |
+
headers = {
|
158 |
+
"Authorization": SMS_TOK,
|
159 |
+
"Content-Type": "application/json"
|
160 |
+
}
|
161 |
+
|
162 |
+
data = {
|
163 |
+
"from": "12085686834",
|
164 |
+
"to": ["18587331029"],
|
165 |
+
"body": resp_text
|
166 |
+
}
|
167 |
+
|
168 |
+
response = requests.post(url, json=data, headers=headers)
|
169 |
+
return response.text
|
170 |
+
return "....."
|
171 |
+
|
172 |
+
|
173 |
+
# gradio block
|
174 |
+
with gr.Blocks() as app1:
|
175 |
+
with gr.Column():
|
176 |
+
gr.Markdown("## 🥷 FoodCAM ##")
|
177 |
+
gr.Markdown("```for email ✉ and/or assigment descriptions ⌦, paste screenshot here...```")
|
178 |
+
image_box = gr.Image(label="✂ email screen", type="filepath")
|
179 |
+
btn1 = gr.Button("Generate To-Dos ☑")
|
180 |
+
out1 = gr.Textbox(label="here are the actionables...")
|
181 |
+
btn2 = gr.Button("(disabled)send to Mobile ↗️")
|
182 |
+
out2 = gr.Textbox(label="(disabled) no message been sent, this is just a mockup confirmation...")
|
183 |
+
|
184 |
+
btn1.click(fn=app1_response, inputs=[image_box], outputs=out1)
|
185 |
+
btn2.click(fn=send_SMS, inputs=out1, outputs=out2)
|
186 |
+
|
187 |
+
gr.Markdown("""
|
188 |
+
# 🥷 Summerize eMail & Make a Plan #
|
189 |
+
|
190 |
+
|
191 |
+
[demo video](https://youtu.be/lJ4jIAEVRNY)
|
192 |
+
|
193 |
+
""")
|
194 |
+
|
195 |
+
examples=[
|
196 |
+
os.path.join(os.path.dirname(__file__), "images/missionemail.png"),
|
197 |
+
],
|
198 |
+
|
199 |
+
with gr.Blocks() as app_quali:
|
200 |
+
with gr.Column():
|
201 |
+
gr.Markdown("## ↗️ my Quali Metrics ##")
|
202 |
+
gr.Markdown("```job descriptions ⌦, paste screenshot here...```")
|
203 |
+
msg_box = gr.Textbox()
|
204 |
+
btn_quali = gr.Button("Generate the Markdwon Q Metrics ☑")
|
205 |
+
out_quali = gr.Textbox(label="here is the table...")
|
206 |
+
btn_quali.click(fn=quali_response, inputs=[msg_box], outputs=out_quali)
|
207 |
+
|
208 |
+
|
209 |
+
gr.Markdown("""
|
210 |
+
# 🥷 Summerize Job Posting and Make a Comparison with Qualifications #
|
211 |
+
|
212 |
+
- screen capture (Win + shift + S)
|
213 |
+
- use MD editor below
|
214 |
+
|
215 |
+
[markdown editor](https://stackedit.io/app#)
|
216 |
+
|
217 |
+
""")
|
218 |
+
|
219 |
+
examples=[
|
220 |
+
os.path.join(os.path.dirname(__file__), "images/missionemail.png"),
|
221 |
+
],
|
222 |
+
|
223 |
+
|
224 |
+
|
225 |
+
with gr.Blocks() as demo:
|
226 |
+
gr.Markdown("## My Quali Metrics ↗️ + FoodCAM 🥷 ##")
|
227 |
+
gr.TabbedInterface([app_quali, app1], ["➀ My Quali", "➁ FoodCAM"])
|
228 |
+
|
229 |
+
demo.queue()
|
230 |
+
demo.launch()
|