GetIntern / app.py
trexhere's picture
Update app.py
75331c0 verified
raw
history blame contribute delete
No virus
3.27 kB
from flask import Flask, request, render_template
from model import DataBase, UsersCollection
import google.generativeai as genai
from config import Config
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def home():
if request.method == 'POST':
name = request.form.get('name', '')
proficiency = request.form.get('level')
# Automation Section
auto_python = request.form.get('auto-python', 'False')
auto_javascript = request.form.get('auto-javascript', 'False')
auto_Py = "Python Automation" if auto_python == 'True' else ""
auto_Js = "JavaScript Automation" if auto_javascript == 'True' else ""
# Web Development Section
web_python = request.form.get('web-python', 'False')
web_javascript = request.form.get('web-javascript', 'False')
webDevPy = "Python Web Development" if web_python == 'True' else ""
webDevJs = "JavaScript Web Development" if web_javascript == 'True' else ""
# Telegram Bot Section
pyrogram = request.form.get('pyrogram', 'False')
ptb = request.form.get('python-telegram-bot', 'False')
pyGm = "Telegram Bot Using Pyrogram" if pyrogram == 'True' else ""
pyTgBot = "Telegram Bot Using Python-Telegram-bot" if ptb == 'True' else ""
Prompt = f"""From Now You Are A Tech Company Named 'AccioINTERN' Who Wanna Hire A Intern For {auto_Py, auto_Js, webDevPy, webDevJs, pyGm, pyTgBot}
To Give InternShip With Proficiency Leval {proficiency}.
Company Details:AccioINTERN, Owner:TraxDinosaur, Contact:traxdinosaur.github.io and
How To Submit Project: First Goto https://s.id/AccioINTERN And Submit Your Github Username,
After Check Email And Join Invitation Of AccioINTERN, Then Upload Your Project.That's It.
Now I'm {name}, I Want Do That Internship. So Give Me A Project To So I Can Submit Project For You."""
genai.configure(api_key=Config.API_KEY)
# Set up the model
generation_config = {
"temperature": 1,
"top_p": 1,
"top_k": 1,
"max_output_tokens": 5000,
}
safety_settings = [
{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_ONLY_HIGH"},
{"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_ONLY_HIGH"},
{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_ONLY_HIGH"},
{"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_ONLY_HIGH"},
]
model = genai.GenerativeModel(
model_name="gemini-pro",
generation_config=generation_config,
safety_settings=safety_settings,
)
prompt = Prompt
response = model.generate_content([prompt])
content = response.candidates[0].content.parts[0].text.replace("*", "")
document = UsersCollection(name,proficiency, auto_Py, auto_Js, webDevPy, webDevJs, auto_python, auto_javascript, web_python, web_javascript, content)
DataBase().add_doc('Data',document)
return render_template("index.html", Result=content)
return render_template("index.html")
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=7860)