todo / app_myQ.py
hsienchen's picture
Upload app_myQ.py
5f46732 verified
raw
history blame
12.7 kB
# refer to repo https://github.com/gradio-app/gradio/blob/main/demo/chatbot_multimodal/run.ipynb for enhancement
import PIL.Image
import gradio as gr
import base64
import time
import os
import google.generativeai as genai
import requests
import pathlib
txt_model = genai.GenerativeModel('gemini-pro')
vis_model = genai.GenerativeModel('gemini-pro-vision')
txt_prompt_1 = """
List all the food items found in the image. Each food item should be listed in a separate row within a markdown table titled "Food-Brain Table." This table should have four columns: Seq (Sequence), Food, Brain-Health Impact, and Rec Intake (Recommended Intake).
In the table:
- "Seq" represents the sequence number of the food item.
- "Food" denotes the name of the food.
- "Brain-Health Impact" describes the positive or negative effects of the food on brain health. For example, it may mention the presence of nutrients like omega-3 fatty acids, which are beneficial for brain health.
- "Rec Intake" specifies the recommended frequency or quantity of consumption for each food item.
Example Food-Brain Table:
| Seq | Food | Brain-Health Impact | Rec Intake |
|-----|---------------|--------------------------------------------------------------------------------------------------------|--------------------------------------|
| 1 | Cod | Cod contains abundant sources of omega-3 fatty acids, healthy unsaturated fats that have been linked to lower blood levels of beta-amyloid—the protein that forms damaging clumps in the brains of people with Alzheimer's disease. | At least twice per week|
"""
txt_display_1 = 'content of the letter: '
txt_prompt_quali = """
Follow the example to make a markdwon Quali Metrics based on the job description content which is provided hereafter. Please note:
-when filling in My Credentials, and Notes please make reference to the Resume Experience below
** Resume Experience
Technical Operator & Material Handler 2021.03 -2022.08
Acutus Medical, Inc., Carlsbad, California
Acutus is a NASDAQ-listed medical device manufacturer specializing in catheters, EP mappers, mapping consoles, and
related supplies. My job duties include:
-Daily Planning for CEA Assembly Lines Material Flow: Oversaw the flow of materials within CEA,
encompassing electronic parts, tubes, ablation tips, balloon crowns, needles, wires, bonding chemicals,
temperature-sensitive elements, gas tanks, tool kits, and MROs.
-Material Transfer Responsibilities: Involved in the picking and transfer of materials between locations.
Conducted examinations of UDI and checked validity before release, collaborating with the QA department on
Non-Conformance Reports (NCRs).
-Line Production Works & Microscopic Soldering Tasks: Assigned to assist in the soldering works for the
production lines of mapper-catheters. The assignment involves using a microscope for hand-soldering
connectors to the unit base.
-Warehousing and Inventory Duties: Engaged in the stocking of approximately 800 parts/components and
recorded data in the QAD Inventory system. Managed inventory cycle counts, conducted book-physical audit
counts, and took part in variance analyses.
-Disposition of HazMat/Scraps: Handled downstream NCR disposition (scrap, rework, return or disposition).
Disposed in-field HazWaste. Assisted ISO sterilization in CEA or CMA zone.
-Shipping and Receiving Support: Subbed in for receiving and shipping tasks. Receiving functions included
checking shipment documents, initiating QAD receipt, and notifying related parties for downstream processes.
Shipping involved using FedEx or UPS for domestic or international shipments.
-Process Improvements: revamped the Kanban system, and participated in a smart cam project (a tablet UDI
tags reader APP).
Function-specific Proficiencies:
● QMS 21 CFR (820 803) and ISO 13485
● cGMP, GLP and good documentation practices
● Nonconforming Material Reporting (NCMR)
● Corrective Action Preventive Action (CAPA)
● Unique Device Identification (UDI)
● OpenFDA surveillance/MAUDE (complaints, adverse events, and malfunctions)
● Stock-out Alert/Visualization
● QAD-ERP and ACSM initiatives (Azure Cloud Solutions for Manufacturing)
● Basic lab skills
Lab Assembly Specialist, Xenowise BioLab, Suzhou, China (2017-2019)
Worked closely with technicians and scientists to establish Patient-Derived Xenograft (PDX) models for drug screening,
CRO candidate screening, and other preclinical pilot-trial studies. My role centered around coordinating processes,
contributing to lab setup, SOP development, and equipment acquisition.
Trainer, Consultant (2000-2015)
Clients: Pfizer, Roche, AstraZeneca (Beijing and Shanghai)
Scope of Work: training courses, and strategy service. Also provide Web-Based Training (WBT) programs covering
regulatory compliance, foundational knowledge, product information, and job-specific skills.
Business Manager, Philogenesis, Inc. (1996-1999, Monrovia, California)
Spearheaded the development and execution of comprehensive marketing strategies to enhance awareness, drive
adoption, and increase market penetration of biomaterial-based blood vessels for Coronary Artery Bypass Grafting
(CABG) procedures.
General Manager, BioMax, Inc. (1993-1996, Monrovia, California)
Oversaw day-to-day operations of the company, focusing on expanding market presence for medical-grade
lyophilized hemostatic collagen patches.
** example Job Post
Fill tablet, bottle, desiccant and closure hoppers. Hand count product using counting trays.
Manufacturing responsibilities include de-inking product, tablet breaking, product placement into oversized capsules and capsule inspection.
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.
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.
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.
All clinical labels must be inspected and require a 100% accountability. Clinical labels can be either manually or automatically applied.
Sealed clinical cards must be inspected for missing copy, poor seal, smudges and dirt, misalign blister units and burnt product.
Inspection required for vials, ampoules and syringes utilizing black and white light boxes.
Cold storage packaging will also be required working with cold product both outside and inside refrigeration conditions.
Assembly work required which may include utilizing barcode scanning equipment and computers.
Other duties as assigned
** example Quali Metrics
| Seq | Tasks | Descriptions | My Credential | Note |
|-----|---------------|-----------------------------------------------------------------------------------------------|--------------------------------------|--------------------|
| 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 | |
| 2 | Manufacturing | De-ink product, tablet breaking, place product into oversized capsules, and inspect capsules. | 10+ years experience in Acutus and Xenowise assembly works | |
| 3 | Inspection | Inspect bottles, pouch seals, blister units, blister cavities, clinical labels, and sealed cards. | 2+ years experience in GMP facility maintenance | |
| 4 | Cleaning | Clean machine equipment, production rooms, and fill in cleaning logbooks. | 5+ years experience in ISO 13485 QA proficiency | |
| 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 | |
| 6 | Assembly | Perform assembly work, utilize barcode scanning equipment, and computers. | 5+ years experience familiar with various assembly responsibilities | |
| 7 | Other | Cold storage packaging, working with cold products, and other duties as assigned. | Seasoned experience with abundant experience | |
below are content of Tasks and Descriptions:
"""
txt_display_quali = '--- '
import os
GOOGLE_API_KEY=os.getenv('GOOGLE_API_KEY')
genai.configure(api_key=GOOGLE_API_KEY)
SMS_URL =os.getenv('SMS_URL')
SMS_TOK =os.getenv('SMS_TOK')
sms_text ="..."
# Image to Base 64 Converter
def image_to_base64(image_path):
with open(image_path, 'rb') as img:
encoded_string = base64.b64encode(img.read())
return encoded_string.decode('utf-8')
# Function that takes User Inputs, generates Response and displays on Chat UI
def quali_response(job_text):
combined_text = txt_prompt_quali + ' '+ job_text
response = txt_model.generate_content(combined_text)
return response.text
# Function that takes User Inputs, generates Response and displays on Chat UI
def app1_response(img):
if not img:
response = txt_model.generate_content(txt_prompt_1)
return response
else:
img = PIL.Image.open(img)
response = vis_model.generate_content([txt_prompt_1,img])
return response.text
# SMS service ends in March 2024, to restore service @Sinch Simple Text
def send_SMS(resp_text):
url = SMS_URL
headers = {
"Authorization": SMS_TOK,
"Content-Type": "application/json"
}
data = {
"from": "12085686834",
"to": ["18587331029"],
"body": resp_text
}
response = requests.post(url, json=data, headers=headers)
return response.text
return "....."
# gradio block
with gr.Blocks() as app1:
with gr.Column():
gr.Markdown("## 🥷 FoodCAM ##")
gr.Markdown("```for email ✉ and/or assigment descriptions ⌦, paste screenshot here...```")
image_box = gr.Image(label="✂ email screen", type="filepath")
btn1 = gr.Button("Generate To-Dos ☑")
out1 = gr.Textbox(label="here are the actionables...")
btn2 = gr.Button("(disabled)send to Mobile ↗️")
out2 = gr.Textbox(label="(disabled) no message been sent, this is just a mockup confirmation...")
btn1.click(fn=app1_response, inputs=[image_box], outputs=out1)
btn2.click(fn=send_SMS, inputs=out1, outputs=out2)
gr.Markdown("""
# 🥷 Summerize eMail & Make a Plan #
[demo video](https://youtu.be/lJ4jIAEVRNY)
""")
examples=[
os.path.join(os.path.dirname(__file__), "images/missionemail.png"),
],
with gr.Blocks() as app_quali:
with gr.Column():
gr.Markdown("## ↗️ my Quali Metrics ##")
gr.Markdown("```job descriptions ⌦, paste screenshot here...```")
msg_box = gr.Textbox()
btn_quali = gr.Button("Generate the Markdwon Q Metrics ☑")
out_quali = gr.Textbox(label="here is the table...")
btn_quali.click(fn=quali_response, inputs=[msg_box], outputs=out_quali)
gr.Markdown("""
# 🥷 Summerize Job Posting and Make a Comparison with Qualifications #
- screen capture (Win + shift + S)
- use MD editor below
[markdown editor](https://stackedit.io/app#)
""")
examples=[
os.path.join(os.path.dirname(__file__), "images/missionemail.png"),
],
with gr.Blocks() as demo:
gr.Markdown("## My Quali Metrics ↗️ + FoodCAM 🥷 ##")
gr.TabbedInterface([app_quali, app1], ["➀ My Quali", "➁ FoodCAM"])
demo.queue()
demo.launch()