AhmadFareedKhan's picture
Rename main.py to app.py
195f4aa verified
raw
history blame contribute delete
No virus
35.4 kB
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import gradio as gr
from openai import OpenAI
import os
from dotenv import load_dotenv
load_dotenv('.env')
api_key = os.getenv('OPENAI_API_KEY')
client = OpenAI(api_key=api_key)
examples = [
{"prompt": """Need Customer Portal built into website
Currently have a semi functional custom build customer portal. The developer kind of left me hanging and it does not have the functionality I need. I need someone to look at what was built and create the needed functionality.
Specifically the ability to have the client logins so that each customer (client) has an admin user who then can add individual users for their facility.
It looks like I can add a “facility admin” and “facility individual” but I do not see how to group them.
Happy to discuss further.
There is a time crunch on this of 2 weeks.
""", "completion": """Hey there,
I'm really sorry to hear about your experience with the previous developer. Taking over and reviving projects that aren't fully complete is something I've done multiple times, and I've managed to turn them around successfully that I took over and completed from the past developers.
From what you've shared, the user hierarchy and grouping seems to be the core issue here. I am an expert in WordPress and in developing custom functionalities, so I'm confident I can structure it in a way where each client admin can smoothly add individual users under their facility.
The 2-week time crunch is tight, but I'm up for the challenge. Let’s connect soon to go into the specifics and plan out the next steps.
Best,
Ahmad
"""},
{"prompt": """Create a Wireframe for a Website
Create a basic wireframe for a new website.
Use my rough outline, copy and the current website.
The format for the deliverable can be any format that best shows the overall website as a wireframe.
""", "completion": """Hello Adam! I can deliver the website wireframes you need to bring your vision to life. With 11+ years of UX design experience - including projects similar to yours - I will quickly conceptualize an intuitive site architecture and layout using your outline and existing site as a guide.
But first we will discuss your goals and your target audience, and I will create a user flow optimized for conversion.
See my project portfolio to give an example of what I can achieve for you
Let's connect to start strategizing your site's optimal user experience. I'm genuinely excited to collaborate with you to craft designs that captivate and convert your users!
Best,
Ahmad S
"""},
{"prompt": """Styled, Selectable Text with custom actions in React Native // iOS App
I am making a React Native app, an advanced eBook of sorts. I'd like to add the ability for a user to highlight and select portions of the text then be presented with a custom context menu as you are in the Books app or Safari.
The text is styled and includes unicode characters. See attached screenshot.
I have tried several open source native elements and I've tried creating my own. I have also tried using a text input but it seems that it needs to be editable to be selectable.
I am interested in exploring the feasibility of the feature I'm trying to implement and working collaboratively with you to achieve it.
I have clear acceptance criteria:
1. Text is styled
2. Text can be used within TouchableOpacity without impeding the ability to trigger highlighting/copying
3. The context menu that appears on highlight is extensible -- I can add further choices from React.
""", "completion": """Hey there!
I came across your job posting, and it immediately caught my attention. I've worked on something quite similar for Sindoor (see case study here: https://apps.apple.com/us/app/sindoor/id1624458201) , so I'm pretty confident that I can tackle this efficiently. Basically, I would use some components to highlight the text and manage a custom menu, handle the text styling and state.
I am expert at React native, and I am always looking to go the extra mile to meet the expectation.
Would love to discuss it when you are available, I will be able to provide a cost within your budget.
Best,
Ahmad
"""},
{"prompt": """Chat Based App - React, cross platform
Only US based developers please apply.
Please read the entire post, before posting a bid.
Looking to build a cross platform chat app for businesses to consumers.
Must have experience building text based chat apps. Location based. Voice calling experience is a plus.
Must have apps on the market, with over 25k active monthly users. Please send links to 5 apps you have built.
Must be living in the US or really be an exceptional programmer (there will be a technical interview).
IMPORTANT: Must be able to build a reasonably bug free app, and have bugs fixed within a reasonable time frame.
Design:
https://www.figma.com/file/lm4fz85kcveTE2vyEuDZrz/Soundglide-App-%7C-Final-Design-%7C-2023-(DD)?type=design&node-id=0-1&mode=design&t=h2t1eg2fFE3njsEb-0
Document
https://docs.google.com/document/d/1AcJIOg-iZ7bZGPGjqom3sIsVPmckTB_vyr4HBRFwb_w/edit?usp=sharing
We will only accept bids from people who have developed an app with
over 25k monthly users. You will be asked to show the code of the app you are claiming to have built.
Quote should be for entire project up until Next Phases in the MVP document.
Please write orange if you read up till here, so I know you have read the posting.
Thank you!
""", "completion": """Hey Orange!😀
I'm a great fit to build your innovative business chat app with my 8+ years of developing highly scalable messaging apps. As a US-based developer, I can collaborate closely to translate your vision into a user-friendly MVP.
My portfolio includes location-based voice/video chat apps with over 50k monthly active users. I'm confident I can deliver a polished UI and robust back-end meeting your quality and timeline needs. I'm excited to make your product idea a reality! Specifically, I'm curious about your top priority features for v1 and how you plan to drive user adoption.
Looking forward to discussing your app in more detail.
Best,
Ahmad S
"""},
{"prompt": """AI Chat Bot
Need to develop a AI CHAT BOT for specific Public School Employee benefits. Would like to have the BOT answer questions about 403B and 457B benefits (similar to 401k) as well as gather basic information to provide an estimate of their state pension. Software already exists as well as the formulas for each states public school employee retirement benefits. May be possible for the BOT to give a basic estimate of monthly income and then provide the ability to get a full report by email and or have a licensed benefit counselor speak over the phone or web and access a calendar to book that.
The enquirer can book appointments, order reports like the above or an Income Retirement Gap, etc via the BOT.
""", "completion": """Hi there,
Your project sounds great, I am always excited to work on apps where AI makes processes easier and automated.
I've had my hands deep on similar projects where chatbots did more than just answer questions; they automated intricate tasks, similar to what you're aiming for with benefits and pensions.
For example, I was part of a team that crafted a chatbot for a financial firm. This bot not only addressed client queries but also automated their onboarding, dished out real-time investment tips, and slotted meetings, all integrated smoothly with their existing systems.
So, incorporating your existing software and state-specific formulas into our chatbot development is something I can do for you.
Here’s a snapshot of the Chatbot Interaction Flow:
The bot kicks off, understanding if the user is leaning towards 403B/457B info or is more curious about a pension estimate.
If pensions are on their mind, the bot utilizes the integrated formulas, gathers a bit of data from the user, and rolls out an estimated monthly income.
Post that, users can opt for in-depth reports or line up a chat with a benefits counselor.
I'm all set to help make this idea a reality. Are you available to discuss it more in detail so that I give you a price within your budget?
Best,
Ahmad
"""},
{"prompt": """Styled, Selectable Text with custom actions in React Native // iOS App
I am making a React Native app, an advanced eBook of sorts. I'd like to add the ability for a user to highlight and select portions of the text then be presented with a custom context menu as you are in the Books app or Safari.
The text is styled and includes unicode characters. See attached screenshot.
I have tried several open source native elements and I've tried creating my own. I have also tried using a text input but it seems that it needs to be editable to be selectable.
I am interested in exploring the feasibility of the feature I'm trying to implement and working collaboratively with you to achieve it.
I have clear acceptance criteria:
1. Text is styled
2. Text can be used within TouchableOpacity without impeding the ability to trigger highlighting/copying
3. The context menu that appears on highlight is extensible -- I can add further choices from React.
""", "completion": """Hey there!
I came across your job posting, and it immediately caught my attention. I've worked on something quite similar for Sindoor (see case study here: URL) , so I'm pretty confident that I can tackle this efficiently. Basically, I would use some components to highlight the text and manage a custom menu, handle the text styling and state.
I am expert at React native, and I am always looking to go the extra mile to meet the expectation.
Would love to discuss it when you are available, I will be able to provide a cost within your budget.
Best,
Ahmad
"""},
{"prompt": """Full Stack developer for mobile app
I am looking for a full stack development team, that can help with updating an existing mobile application. Not limited to UX/UI, but an overall update to carry out project expectations. An innovative thinker that can pick up the pieces and continue with the vision. RUBY stack AWS FRONT and back end development. Also, familiar with AI and future technologies
""", "completion": """Hey,
I totally get the need to not just update but really elevate an existing mobile application, especially in today's dynamic tech scene. My team and I have been on the front lines of taking projects, understanding the original vision, and pushing them to their fullest potential.
A couple of things about us:
- We're well-versed in full-stack development, especially with the RUBY stack and AWS. So, whether it's FRONT or back end, we've got it covered.
- We've also got some cool AI projects under our belt, like a transcript tool able to identify the speaker and the emotions exchanged during a meeting.
It'd be awesome to dive into your app, see where it's at, and chat about where you want to take it. We can do a free assessment of the existing code and provide our recommendation. Let's sync up on a call soon?
Cheers,
Ahmad
"""},
{"prompt": """Hello, I am in need of a Python script I can execute locally on my computer that will transcribe YouTube videos.
I found an open source Google Colab script that does 85% of what I need. The script and repo links are below. I would like to have this script altered to include:
Converted from a Colab notebook to a script I can execute locally on my machine. I am on a Macbook, have Python (python3) installed, and have some experience running Python scripts.
Currently, the script saves the output files to your Google Colab folder. I would like to save the files to my personal Google Drive account instead.
In addition to the files the script outputs, I would like it to convert the transcription to JSON format and save it to a file.
Links to the script:
https://colab.research.google.com/github/ArthurFDLR/whisper-youtube/blob/main/whisper_youtube.ipynb
https://github.com/ArthurFDLR/whisper-youtube
Happy to answer any questions you have. Thank you.""", "completion": """Hi Robert,
I looked into the links, I can modify the Python script for YouTube transcription.
Been working with Python for a while, and very experienced in it. See for instance ScrenR Health ( https://www.screnrhealth.com ) that I recently completed using Python.
My solution will:
Convert Colab notebook to local Python script.
Save output files to your Google Drive.
Generate JSON transcription.
Let's hop on a call to discuss the details. Eager to assist you!
Best,
Ahmad S"""},
{"prompt": """We are looking for a re-do of our current website - a tour company that offers kayak adventures along a river.
The total site is approximately 25 pages
The current site structure (URL) needs to be maintained
The site needs to be built in WordPress
Current site content exists but does need to be re-worked based upon the design and current SEO best practices
Site will need to incorporate a 3rd party booking tool
The completed website will need to pass the Core Web Vitals
We are okay with using a theme/template like this: https://themeforest.net/item/tour-package-wordpress-traveltour-theme/5360508?_ga=2.257169672.2057898105.1708978830-1609758837.1708640110 or similar
Please let us know the following:
---What builder you will use
--Hosting and ongoing support options
--Time frame for delivery
--Overview of your process
Your team must be fluent in English, work US-based hours, and have a minimum earnings of $50,000""", "completion": """Howdy David,
We are a US based, Top-Rated Agency with $90k+ earnings on Upwork. We'll be utilizing Elementor to craft your new website, ensuring a seamless user experience and stunning visual appeal. As for hosting and ongoing support, we offer reliable options tailored to your needs, ensuring your website stays up and running smoothly. Our team operates on US-based hours (EST timezone) to guarantee efficient communication and support whenever you need it.
For the 3rd party booking tool, it will be straight forward (let me know if you need some suggestions) and it will enhance the user experience and streamline the reservation process for your customers. Plus, we're committed to ensuring that the completed website passes the Core Web Vitals, optimizing its performance and user satisfaction.
We can have your website up and running within 1-2 weeks. Our process involves thorough collaboration with you, incorporating your feedback every step of the way to ensure we're aligned with your vision.
Have a glance at some of our WordPress projects:
https://www.elecbrakes.com : we realized the project design and the we developed it using Wordpress and WooCommerce.
https://blackmilkclothing.com : we improved their UX/UI to grow sales
https://www.dripgym.com : we revamped their existing website, increasing their sales from $1M to $2M!
Are you available to hop on a call so that we finalize the details? Let's chat!
Ahmad"""},
{"prompt": """Hello!
We are looking to reskin our mobile app and website, based on our new brand identity.
The pages are already designed and developed, and FIGMA file is available to work on.
This is mainly about reflecting the new brand guidelines on the existing layout.
Attached is the brief with more details.
Timeline:
Website 5 days
Mobile App: 5 days after locking the website design
Reach out if you're up for a quick challenge ;)
""", "completion": """Hey there,
I have reviewed the Blue Kingdom attached file, thank you for putting this together!
I am an expert UX/UI designer and I can effectively reskin your existing website and mobile app designs to accurately reflect your new brand identity guidelines, and make it stand out. My expertise lies in translating brand elements into visually appealing and consistent digital experiences across platforms.
Your website and app need to be fresh and inviting to your target audience, while maintaining a slight differentiation in look and feel between them. With my skills, I can deliver the reskinned designs for the 10 pages/subpages of your website within 4 days, and subsequently, the 10 pages/subpages of your mobile app in an additional 4 days.
My portfolio (https://www.behance.net/falconconsulting) showcases successful reskinning projects, including redesign based on brand guidelines.
When you are ready, let’s hop on a call, I will let you know my process to make your project happen smoothly!
Best,
Ahmad S"""},
{"prompt": """William Wu, Magnolia
Looking to create an eye catching jewelry content/graphics built on magento. I can supply product images but would need artificial background etc
added a sample product image that can be used for content.
(link removed) is the website that needs the content to be updated.
Please provide a sample image that you created to show what you can do based on the attached image and website above.
The website is for the US Chinese Market
Added sample image to show what is needed.""", "completion": """Hi there.
Interesting project, I would be glad to help designin a stunning website for your jewelry products.
I know how to make a project stand out! See for instance Dripgym.com , done also with Magento, that I have redesigned, increasing the sales from $1M to $2M.
I have a step-by-step process for these types of projects, happy to discuss it.
If you are interested, let’s schedule a call to discuss the details.
Best,
Ahmad S"""},
{"prompt": """Hi,
I am looking for a full stack development team to help finalise our ecommerce loyalty program.
The core features have been built, including:
Analytics
Rewards builder
Campaign scheduling
Review management
3rd party integrations. (Shopify/woocomerce/magneto/bigcommerce
This is built with next js and node js.
We are looking to go live urgently, hopefully in the next 3.5 weeks, we need your help with:
Integrate the referral landing page which has been built, but requires a back end and database connection
Update the 3rd party integrations to include customer spend, and contact information
Connect social media APIs, for our points programs. Example “share on Instagram for 10 points”
Update the analytics feature, to track a few more data points
+ more.
A big focus would be on front end UI, we are looking for a complete revamp and improvement. (UX, styling & design)
There will be a full time position available as we need your help pushing this live. E-commerce experience is a big benefit, to work with us. Please provide simialr work, including FIGMAs as design is important for us.
***This is my final budget it’s fixed.***
Please see my comments here and review the Google document shared within this document: (link removed)
""", "completion": """Hey Tom!
Excited to review your project requirements, especially the focus on enhancing the front-end UI for your ecommerce loyalty program. As a top talent on Upwork with over 11 years of experience, I've successfully completed similar projects with a keen eye for detail and a focus on user experience.
Projects I've handled include:
https://www.quadrabase.fr - Leveraged React and NodeJS to develop a comprehensive web application for the construction sector, emphasizing intuitive user interfaces and seamless functionality.
https://getveriscan.com/ - Created a cutting-edge system for identifying registered bullion products using ReactJS and NodeJS. It's innovative, reliable, and just plain cool.
Regarding your project, I understand the urgency of going live within the next 3.5 weeks. I'm well-equipped to integrate the referral landing page, update third-party integrations, connect social media APIs, and enhance the analytics feature to track additional data points. Also I am an expert at frontend UI revamps, ensuring improved UX, styling, and design.
Let's discuss further details and kickstart this project to meet your deadline. Looking forward to connecting!
Best,
Ahmad"""},
{"prompt": """We are seeking a talented Web Developer with experience in geolocation integration, to join our team on a project basis. The ideal candidate will have a strong understanding of WordPress development, including proficiency with Elementor page builder, and the ability to implement geolocation functionality without the use of paid tools. Additionally, the candidate will be responsible for creating a sticky banner with geolocation functionality to be placed at the top of our website footer, ensuring it seamlessly integrates with our existing site structure. Also additional Wordpress and web tasks like custom css code needs, additional plugins needs and bug-fixes will be under the scope of this role.
Responsibilities:
Develop and implement geolocation functionality on our WordPress website without using paid tools.
Create a sticky banner with geolocation functionality and integrate it into the footer of our website using Elementor, ensuring it does not disrupt the site layout.
Collaborate with the design and marketing teams to ensure the geolocation features align with our brand and user experience goals.
Test and debug code to ensure optimal performance and compatibility across various devices and browsers.
Provide documentation and support to ensure the smooth integration and maintenance of geolocation and other plugin features.
Requirements:
Proficiency in WordPress development, including theme customization and plugin development.
Experience with Elementor page builder and ability to create custom elements and templates.
Strong understanding of geolocation integration techniques without relying on paid tools.
Knowledge of HTML, CSS, JavaScript, and PHP.
Effective communication and collaboration skills in English.
Nice to Have:
Familiarity with SEO best practices.
Experience with responsive and mobile-friendly web design.
""", "completion": """Hi there!
Thanks for the detailed JD, it seems you are looking for a skills Wordpress developer who can reinforce your team on a project base and ensure project success. I feel like I would be a great fit for that, and I have all the must haves and nice to have mentioned in the job description.
I am actually working in a similar fashion with some other partners, see two projects I have completed recently which are relatable to the one you described:
- PetsConnections (LINK)- Wordpress website for pet lovers, with a multitude of features such as: blog, news feed, events calendar, directory, map listing, etc…I completed the website within a month.
- Children Entrepreneurs (LINK) - Developed a robust Wordpress website with a lot of custom development in Javascript and PHP.
In these types of partnerships, I typically get on a kickoff meeting before starting a project, making sure we are aligned on the requirement. Then I am quite independent, but I make sure to provide a detailed daily report, and I am available to hop on a call when needed.
When you are ready, let’s get on a call so that we can discuss the details!
Best,
Ahmad
"""},
{"prompt": """We are looking for an experienced full-stack engineer who has 3+ years of commercial experience. The project by itself is a calorie tracker but it is planned to be as a white label with an extended admin panel along with advanced user statistics collecting for further data analysis to give users advice about calories and food ration.
Our stack:
- Frontend - React/React Native
- Backend - Node.Js
Requirements:
- Experience in commercial projects using React/React Native(nice to have)
- Experience in commercial projects using Node/Express
- Experience in commercial projects using AWS
- Good English skills (Would be required syncs with the client)
""", "completion": """Hi there,
This project sounds like a great initiative that aligns well with today’s health-conscious trends. I’m excited about the potential it holds!
As a Top Talent Plus full-stack engineer on Upwork, I bring over 11 years of experience in developing robust and scalable applications in MERN and React Native stacks. Here are a few projects I have recently completed with these stacks:
- ScrenR Health ( https://www.screanrhealth.com ) : mobile and web telehealth platform allowing patients to do exercises remotely with AR/ML for motion detection and joints analysis. Comprehensive dashboard for clinicians with advanced data analytics.
- Orgaplan (LINK): Logistic management platform for complex construction projects, deployed in a top Contracting firm.
I am used to work in Agile mode: I provide daily updates, I am experienced using PM tools such as Trello or Jira, and I like to be very transparent on my progress. I am also good at anticipating roadblocks and proposing solutions to save time and money!
Let’s discuss if I can be a good fit in the team. Let me know when we can hop on a call.
Best,
Ahmad
"""},
{"prompt": """Hi applicants.
I have a layout in Figma, I need to implement a platform.
We would like to see in the first iteration:
1) Login/Registration
2) Home screen
3) Organization selection screen
4) Screen with a detailed selection of organization
5) Screen with statistics on the success of organizations
Stack: React + Node.js
We will provide technical specifications and a link to the design during a personal conversation with the candidates we like
""", "completion": """Hi there,
Thanks for the description, it seems very straight forward. These are typically the features that I develop when working on a directory type of project, or even a marketplace.
Here are few projects where I developed similar features in React/NodeJs:
- Permispop (LINK) : marketplace connecting driving schools, teachers and students, with a complete set of features.
- Baddour Car Rentals (LINK) : Mobile and web application for connecting renters and car owners. The renter can see the list of cars, and the details of the car owner.
- Sindoor (LINK) : Marketplace connecting couple with wedding vendors: all the features you mentioned are in this project.
I will make sure to develop a pixel perfect web app, based on your design.
My coding process ensures seamless integration, focusing on modular design for easy updates and maintenance, and cost-effective implementation without compromising on quality.
Let’s schedule a call to discuss the details, review the Figma mockups, and offer a competitive price that fits your budget.
Best,
Ahmad
"""}]
def count_words(text):
return len(text.split())
def find_matching_projects(job_description, portfolio_df, top_n=3):
# Combine relevant fields into a single string for vectorization
portfolio_df['combined'] = portfolio_df.apply(lambda row: f"{row['Scope Done']} {row['Technology']} {row['Domain']}".lower(), axis=1)
job_description = job_description.lower()
# Initialize the CountVectorizer
vectorizer = CountVectorizer()
# Fit and transform the combined texts along with the job description
combined_texts = portfolio_df['combined'].tolist() + [job_description]
vectors = vectorizer.fit_transform(combined_texts).toarray()
# Compute cosine similarity between the last vector (job description) and all others
cosine_sim = cosine_similarity([vectors[-1]], vectors[:-1])
# Find indices of the top matches
top_matches = np.argsort(cosine_sim[0])[-top_n:][::-1]
return portfolio_df.iloc[top_matches].to_dict(orient='records')
# examples = ' '.join([f"Input: {example['prompt']}\nOutput: {example['completion']}" for example in examples])
def generate_response(job_description, skills, budget):
word_count = count_words(job_description)
if word_count < 50:
max_tokens = 200 # Adjust to fit the lower limit if necessary
elif 50 <= word_count <= 120:
max_tokens = 300 # Adjust to match the range 50-80 words
else:
max_tokens = 450 # Adjust to keep the response at 80 words
proposal_template = """You will act as a Top Upwork proposal writer, have great experience in converting leads. Your percentage of answered proposals is among the bests. You are also a Tech expert, and you know how to adapt to the client to be detailed or synthetic.
I will send you some Upwork projects, and you will provide a proposal for it. The proposal should be based on the following template:
Main Proposal template (Sentence 1, 3, 4, 6, 7 are top priority.): talk as if you are a freelancer, between 100 and 150 tokens (If job description is more than 100 tokens and if the job description is less than 100 tokens then you will write less than 100 tokens proposal), . Tone is friendly and nice, not too professional, and not too cool either. It should feel like someone talking face-to-face. Also, make sure you are not repeating yourself, and do not add sentences with no clear purpose (like “I hope you are doing well”, etc…). Get inspired by the examples of answers provided
Typical structure (you have the flexibility to change it as needed, and adapt it to the job description);
Sentence 1: Hi there / Hi (NameofClient) if provided
Sentence 2 (optional, only if the job description is more than 100 tokens and specific enough to understand the requirements): quick feedback on the project OR something which resonates in the job description.
Example: telling about how exciting/original/helpful/ambitious is the project, or anything insightful about the project (example: totally agreed with the tech stack, etc…). Don't use words like sounds exciting, overwhelmed, keen etc everytime. Do not exaggerate and provide genuine feedback, which would feel natural. Needs to be one sentence max.
Sentence 3: Assert my authority (Top Talent Plus on Upwork, meeting the requirement, experience of 11 years, did similar projects (list them with Name, URL and a short Description). Make sure to present relevant projects as we are providing you e.g start the line with - and don't style it like you do make it bold etc present the projects simply as you are getting. If the job description is less than 80 tokens then only list 1 project with a one line short description and if the job description is too broad like more than 100 tokens and context is clear then try to list 2 projects and make sure every time the url should be listed of the project. List the projects like a bullet point. Only mention projects from the relevant projects i provide you.
If the Job description is too broad / not precise, send him the project portfolio.
Sentence 4 (Don't include this sentence everytime. On first time you will not include it but when the same job description is given to you 2nd time then you will include this sentence): Rephrase the requirement (high level summary), provide some technical insights if possible (for instance tell how it would be technically done) (only if the scope is sufficiently defined)
Sentence 5: my process (needs to show how structured it is, seamless, risk-free as compared to others, and cost effective) (big picture, if needed)
Sentence 6: Call to action (let’s get on a call). Tell what the client will get from it.
Example: recommendations about the design / code / approach, and a price within his budget.
Sentence 7 : Signature :
Best,
Ahmad
"""
portfolio_path = 'Projects.xlsx'
portfolio_df = pd.read_excel(portfolio_path)
matched_projects = find_matching_projects(job_description, portfolio_df)
projects_info = "\n".join([f"- {proj['Name']} ({proj['URL']}) - {proj['Description']}" for proj in matched_projects])
examples_content = "\n".join([f"Example prompt: {ex['prompt']}\nExample completion: {ex['completion']}\n" for ex in examples])
context = f"{proposal_template}\nExamples:\n{examples_content}\nRelevant Projects:\n{projects_info}\n\nThis is the Job Description:\n{job_description}"
print(context)
detailed_input= f"Job description: {job_description}, Required Skills: {skills}, Budget: {budget}"
completion = client.chat.completions.create(
model="gpt-3.5-turbo-0125",
temperature=0.7,
max_tokens=max_tokens,
messages=[
{"role": "system", "content": context},
{"role": "user", "content": detailed_input}
]
)
return completion.choices[0].message.content
# def find_matching_projects(job_description, portfolio_df, top_n=5):
# # Combine relevant fields into a single string for vectorization
# portfolio_df['combined'] = portfolio_df.apply(lambda row: f"{row['Scope Done']} {row['Technology']} {row['Domain']}".lower(), axis=1)
# job_description = job_description.lower()
# # Initialize the CountVectorizer
# vectorizer = CountVectorizer()
# # Fit and transform the combined texts along with the job description
# combined_texts = portfolio_df['combined'].tolist() + [job_description]
# vectors = vectorizer.fit_transform(combined_texts).toarray() # Ensure to convert to array
# # Compute cosine similarity between the last vector (job description) and all others
# cosine_sim = cosine_similarity([vectors[-1]], vectors[:-1])
# # Find indices of the top matches
# top_matches = np.argsort(cosine_sim[0])[-top_n:][::-1]
# print("Top matching indices:", top_matches)
# print("Cosine similarity scores:", cosine_sim[0][top_matches])
# print("Matched projects:")
# print(portfolio_df.iloc[top_matches])
# return portfolio_df.iloc[top_matches].to_dict(orient='records')
# def generate_proposal(job_description):
# portfolio_path = 'Falcon Projects Portfolio.xlsx'
# portfolio_df = pd.read_excel(portfolio_path)
# matched_projects = find_matching_projects(job_description, portfolio_df)
# projects_info = "\n".join([f"- {proj['Name']} ({proj['URL']}) - {proj['Description']}" for proj in matched_projects])
# prompt_with_projects = f"Relevant Projects:\n{projects_info}\n\nThis is the Job Description: \n{job_description}"
# example = f"\n".join([f"Input: {example['prompt']}\nOutput: {example['completion']}" for example in examples])
# formatted_prompt = f"{prompt_with_projects}\n\n\n Following are the examples in which the input is the job description and the output is the generated proposal. You have to learn the tone used in the examples while generating proposal:\n\n {example}"
# print(formatted_prompt)
# completion = generate_response(formatted_prompt)
# return completion
interface = gr.Interface(
fn=generate_response,
inputs=[
gr.Textbox(label="Job Description"),
gr.Textbox(label="Required Skills", placeholder="Enter skills separated by semi-colons, e.g., Python; Machine Learning; Data Analysis"),
gr.Number(label="Budget", info="Enter the budget in USD"),
],
outputs=gr.Textbox(label="Generated Proposal"),
title="Proposal Generator",
description="Generates tailored proposals based on the provided job description and matching projects from the portfolio."
)
interface.launch()