-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update-docs
- Loading branch information
Showing
16 changed files
with
1,363 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ streamlit | |
phidata | ||
openai | ||
google-search-results | ||
newspaper3k | ||
newspaper4k | ||
lxml_html_clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
phidata==2.5.33 | ||
streamlit==1.40.2 | ||
qdrant-client==1.12.1 | ||
openai | ||
|
||
openai | ||
pypdf | ||
duckduckgo-search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# 🩻 Medical Imaging Diagnosis Agent | ||
|
||
A Medical Imaging Diagnosis Agent build on phidata powered by Gemini 2.0 Flash Experimental that provides AI-assisted analysis of medical images of various scans. The agent acts as a medical imaging diagnosis expert to analyze various types of medical images and videos, providing detailed diagnostic insights and explanations. | ||
|
||
## Features | ||
|
||
- **Comprehensive Image Analysis** | ||
- Image Type Identification (X-ray, MRI, CT scan, ultrasound) | ||
- Anatomical Region Detection | ||
- Key Findings and Observations | ||
- Potential Abnormalities Detection | ||
- Image Quality Assessment | ||
- Research and Reference | ||
|
||
## How to Run | ||
|
||
1. **Setup Environment** | ||
```bash | ||
# Clone the repository | ||
git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git | ||
cd ai_agent_tutorials/ai_medical_imaging_agent | ||
|
||
# Install dependencies | ||
pip install -r requirements.txt | ||
``` | ||
|
||
2. **Configure API Keys** | ||
- Get Google API key from [Google AI Studio](https://aistudio.google.com) | ||
|
||
3. **Run the Application** | ||
```bash | ||
streamlit run ai_medical_imaging.py | ||
``` | ||
|
||
## Analysis Components | ||
|
||
- **Image Type and Region** | ||
- Identifies imaging modality | ||
- Specifies anatomical region | ||
|
||
- **Key Findings** | ||
- Systematic listing of observations | ||
- Detailed appearance descriptions | ||
- Abnormality highlighting | ||
|
||
- **Diagnostic Assessment** | ||
- Potential diagnoses ranking | ||
- Differential diagnoses | ||
- Severity assessment | ||
|
||
- **Patient-Friendly Explanations** | ||
- Simplified terminology | ||
- Detailed first-principles explanations | ||
- Visual reference points | ||
|
||
## Notes | ||
|
||
- Uses Gemini 2.0 Flash for analysis | ||
- Requires stable internet connection | ||
- API usage costs apply | ||
- For educational and development purposes only | ||
- Not a replacement for professional medical diagnosis | ||
|
||
## Disclaimer | ||
|
||
This tool is for educational and informational purposes only. All analyses should be reviewed by qualified healthcare professionals. Do not make medical decisions based solely on this analysis. |
157 changes: 157 additions & 0 deletions
157
ai_agent_tutorials/ai_medical_imaging_agent/ai_medical_imaging.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
import os | ||
from PIL import Image | ||
from phi.agent import Agent | ||
from phi.model.google import Gemini | ||
import streamlit as st | ||
from phi.tools.duckduckgo import DuckDuckGo | ||
|
||
if "GOOGLE_API_KEY" not in st.session_state: | ||
st.session_state.GOOGLE_API_KEY = None | ||
|
||
with st.sidebar: | ||
st.title("ℹ️ Configuration") | ||
|
||
if not st.session_state.GOOGLE_API_KEY: | ||
api_key = st.text_input( | ||
"Enter your Google API Key:", | ||
type="password" | ||
) | ||
st.caption( | ||
"Get your API key from [Google AI Studio]" | ||
"(https://aistudio.google.com/apikey) 🔑" | ||
) | ||
if api_key: | ||
st.session_state.GOOGLE_API_KEY = api_key | ||
st.success("API Key saved!") | ||
st.rerun() | ||
else: | ||
st.success("API Key is configured") | ||
if st.button("🔄 Reset API Key"): | ||
st.session_state.GOOGLE_API_KEY = None | ||
st.rerun() | ||
|
||
st.info( | ||
"This tool provides AI-powered analysis of medical imaging data using " | ||
"advanced computer vision and radiological expertise." | ||
) | ||
st.warning( | ||
"⚠DISCLAIMER: This tool is for educational and informational purposes only. " | ||
"All analyses should be reviewed by qualified healthcare professionals. " | ||
"Do not make medical decisions based solely on this analysis." | ||
) | ||
|
||
medical_agent = Agent( | ||
model=Gemini( | ||
api_key=st.session_state.GOOGLE_API_KEY, | ||
id="gemini-2.0-flash-exp" | ||
), | ||
tools=[DuckDuckGo()], | ||
markdown=True | ||
) if st.session_state.GOOGLE_API_KEY else None | ||
|
||
if not medical_agent: | ||
st.warning("Please configure your API key in the sidebar to continue") | ||
|
||
# Medical Analysis Query | ||
query = """ | ||
You are a highly skilled medical imaging expert with extensive knowledge in radiology and diagnostic imaging. Analyze the patient's medical image and structure your response as follows: | ||
### 1. Image Type & Region | ||
- Specify imaging modality (X-ray/MRI/CT/Ultrasound/etc.) | ||
- Identify the patient's anatomical region and positioning | ||
- Comment on image quality and technical adequacy | ||
### 2. Key Findings | ||
- List primary observations systematically | ||
- Note any abnormalities in the patient's imaging with precise descriptions | ||
- Include measurements and densities where relevant | ||
- Describe location, size, shape, and characteristics | ||
- Rate severity: Normal/Mild/Moderate/Severe | ||
### 3. Diagnostic Assessment | ||
- Provide primary diagnosis with confidence level | ||
- List differential diagnoses in order of likelihood | ||
- Support each diagnosis with observed evidence from the patient's imaging | ||
- Note any critical or urgent findings | ||
### 4. Patient-Friendly Explanation | ||
- Explain the findings in simple, clear language that the patient can understand | ||
- Avoid medical jargon or provide clear definitions | ||
- Include visual analogies if helpful | ||
- Address common patient concerns related to these findings | ||
### 5. Research Context | ||
IMPORTANT: Use the DuckDuckGo search tool to: | ||
- Find recent medical literature about similar cases | ||
- Search for standard treatment protocols | ||
- Provide a list of relevant medical links of them too | ||
- Research any relevant technological advances | ||
- Include 2-3 key references to support your analysis | ||
Format your response using clear markdown headers and bullet points. Be concise yet thorough. | ||
""" | ||
|
||
st.title("🏥 Medical Imaging Diagnosis Agent") | ||
st.write("Upload a medical image for professional analysis") | ||
|
||
# Create containers for better organization | ||
upload_container = st.container() | ||
image_container = st.container() | ||
analysis_container = st.container() | ||
|
||
with upload_container: | ||
uploaded_file = st.file_uploader( | ||
"Upload Medical Image", | ||
type=["jpg", "jpeg", "png", "dicom"], | ||
help="Supported formats: JPG, JPEG, PNG, DICOM" | ||
) | ||
|
||
if uploaded_file is not None: | ||
with image_container: | ||
# Center the image using columns | ||
col1, col2, col3 = st.columns([1, 2, 1]) | ||
with col2: | ||
image = Image.open(uploaded_file) | ||
# Calculate aspect ratio for resizing | ||
width, height = image.size | ||
aspect_ratio = width / height | ||
new_width = 500 | ||
new_height = int(new_width / aspect_ratio) | ||
resized_image = image.resize((new_width, new_height)) | ||
|
||
st.image( | ||
resized_image, | ||
caption="Uploaded Medical Image", | ||
use_container_width=True | ||
) | ||
|
||
analyze_button = st.button( | ||
"🔍 Analyze Image", | ||
type="primary", | ||
use_container_width=True | ||
) | ||
|
||
with analysis_container: | ||
if analyze_button: | ||
image_path = "temp_medical_image.png" | ||
with open(image_path, "wb") as f: | ||
f.write(uploaded_file.getbuffer()) | ||
|
||
with st.spinner("🔄 Analyzing image... Please wait."): | ||
try: | ||
response = medical_agent.run(query, images=[image_path]) | ||
st.markdown("### 📋 Analysis Results") | ||
st.markdown("---") | ||
st.markdown(response.content) | ||
st.markdown("---") | ||
st.caption( | ||
"Note: This analysis is generated by AI and should be reviewed by " | ||
"a qualified healthcare professional." | ||
) | ||
except Exception as e: | ||
st.error(f"Analysis error: {e}") | ||
finally: | ||
if os.path.exists(image_path): | ||
os.remove(image_path) | ||
else: | ||
st.info("👆 Please upload a medical image to begin analysis") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
streamlit==1.40.2 | ||
phidata==2.7.3 | ||
Pillow==10.0.0 | ||
duckduckgo-search==6.4.1 | ||
google-generativeai==0.8.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# 💼 AI Recruitment Agent Team | ||
|
||
A Streamlit application that simulates a full-service recruitment team using multiple AI agents to automate and streamline the hiring process. Each agent represents a different recruitment specialist role - from resume analysis and candidate evaluation to interview scheduling and communication - working together to provide comprehensive hiring solutions. The system combines the expertise of technical recruiters, HR coordinators, and scheduling specialists into a cohesive automated workflow. | ||
|
||
## Features | ||
|
||
#### Specialized AI Agents | ||
|
||
- Technical Recruiter Agent: Analyzes resumes and evaluates technical skills | ||
- Communication Agent: Handles professional email correspondence | ||
- Scheduling Coordinator Agent: Manages interview scheduling and coordination | ||
- Each agent has specific expertise and collaborates for comprehensive recruitment | ||
|
||
|
||
#### End-to-End Recruitment Process | ||
- Automated resume screening and analysis | ||
- Role-specific technical evaluation | ||
- Professional candidate communication | ||
- Automated interview scheduling | ||
- Integrated feedback system | ||
|
||
## Important Things to do before running the application | ||
|
||
- Create/Use a new Gmail account for the recruiter | ||
- Enable 2-Step Verification and generate an App Password for the Gmail account | ||
- The App Password is a 16 digit code (use without spaces) that should be generated here - [Google App Password](https://support.google.com/accounts/answer/185833?hl=en) Please go through the steps to generate the password - it will of the format - 'afec wejf awoj fwrv' (remove the spaces and enter it in the streamlit app) | ||
- Create/ Use a Zoom account and go to the Zoom App Marketplace to get the API credentials : | ||
[Zoom Marketplace](https://marketplace.zoom.us) | ||
- Go to Developer Dashboard and create a new app - Select Server to Server OAuth and get the credentials, You see 3 credentials - Client ID, Client Secret and Account ID | ||
- After that, you need to add a few scopes to the app - so that the zoom link of the candidate is sent and created through the mail. | ||
- The Scopes are meeting:write:invite_links:admin, meeting:write:meeting:admin, meeting:write:meeting:master, meeting:write:invite_links:master, meeting:write:open_app:admin, user:read:email:admin, user:read:list_users:admin, billing:read:user_entitlement:admin, dashboard:read:list_meeting_participants:admin [last 3 are optional] | ||
|
||
## How to Run | ||
|
||
1. **Setup Environment** | ||
```bash | ||
# Clone the repository | ||
git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git | ||
cd ai_agent_tutorials/ai_recruitment_agent_team | ||
|
||
# Install dependencies | ||
pip install -r requirements.txt | ||
``` | ||
|
||
2. **Configure API Keys** | ||
- OpenAI API key for GPT-4o access | ||
- Zoom API credentials (Account ID, Client ID, Client Secret) | ||
- Email App Password of Recruiter's Email | ||
|
||
3. **Run the Application** | ||
```bash | ||
streamlit run ai_recruitment_agent_team.py | ||
``` | ||
|
||
## System Components | ||
|
||
- **Resume Analyzer Agent** | ||
- Skills matching algorithm | ||
- Experience verification | ||
- Technical assessment | ||
- Selection decision making | ||
|
||
- **Email Communication Agent** | ||
- Professional email drafting | ||
- Automated notifications | ||
- Feedback communication | ||
- Follow-up management | ||
|
||
- **Interview Scheduler Agent** | ||
- Zoom meeting coordination | ||
- Calendar management | ||
- Timezone handling | ||
- Reminder system | ||
|
||
- **Candidate Experience** | ||
- Simple upload interface | ||
- Real-time feedback | ||
- Clear communication | ||
- Streamlined process | ||
|
||
## Technical Stack | ||
|
||
- **Framework**: Phidata | ||
- **Model**: OpenAI GPT-4o | ||
- **Integration**: Zoom API, EmailTools Tool from Phidata | ||
- **PDF Processing**: PyPDF2 | ||
- **Time Management**: pytz | ||
- **State Management**: Streamlit Session State | ||
|
||
|
||
## Disclaimer | ||
|
||
This tool is designed to assist in the recruitment process but should not completely replace human judgment in hiring decisions. All automated decisions should be reviewed by human recruiters for final approval. | ||
|
||
## Future Enhancements | ||
|
||
- Integration with ATS systems | ||
- Advanced candidate scoring | ||
- Video interview capabilities | ||
- Skills assessment integration | ||
- Multi-language support |
Oops, something went wrong.