TraxDinosaur
commited on
Commit
•
53661ae
1
Parent(s):
f1da042
Initial Commit
Browse files- Dockerfile +13 -0
- app.py +82 -0
- config.py +3 -0
- model.py +34 -0
- requirements.txt +2 -0
- static/index.css +107 -0
- templates/index.html +43 -0
Dockerfile
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
RUN useradd -m -u 1000 user
|
4 |
+
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
8 |
+
|
9 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
10 |
+
|
11 |
+
COPY --chown=user . /app
|
12 |
+
|
13 |
+
CMD ["python", "app.py"]
|
app.py
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, request, render_template
|
2 |
+
from config import Config
|
3 |
+
import requests
|
4 |
+
|
5 |
+
|
6 |
+
app = Flask(__name__)
|
7 |
+
|
8 |
+
@app.route('/', methods=['GET', 'POST'])
|
9 |
+
def home():
|
10 |
+
if request.method == 'POST':
|
11 |
+
|
12 |
+
name = request.form.get('name', '')
|
13 |
+
|
14 |
+
# Automation Section
|
15 |
+
auto_python = request.form.get('auto-python', 'False')
|
16 |
+
auto_javascript = request.form.get('auto-javascript', 'False')
|
17 |
+
print(f"Automation: {auto_python}, {auto_javascript}")
|
18 |
+
|
19 |
+
auto_Py = "Automation Python" if auto_python == 'True' else ""
|
20 |
+
auto_Js = "Automation JavaScript" if auto_javascript == 'True' else ""
|
21 |
+
print(f"Selected Automation: {auto_Py}, {auto_Js}")
|
22 |
+
|
23 |
+
# Web Development Section
|
24 |
+
web_python = request.form.get('web-python', 'False')
|
25 |
+
web_javascript = request.form.get('web-javascript', 'False')
|
26 |
+
print(f"Web Development: {web_python}, {web_javascript}")
|
27 |
+
|
28 |
+
webDevPy = "Web Development Python" if web_python == 'True' else ""
|
29 |
+
webDevJs = "Web Development JavaScript" if web_javascript == 'True' else ""
|
30 |
+
print(f"Selected Web Development: {webDevPy}, {webDevJs}")
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
url = "https://api.forefront.ai/v1/chat/completions"
|
36 |
+
apiKey = Config.API_KEY
|
37 |
+
|
38 |
+
print(f"{auto_Py, auto_Js, webDevPy, webDevJs}")
|
39 |
+
|
40 |
+
Prompt = f"""From Now You Are A Tech Compnay Named 'GetIntern' Who Wanna Hire A Intern For {auto_Py, auto_Js, webDevPy, webDevJs} To Give InternShip.
|
41 |
+
I'm {name},I Want Do That Internship.So Give Me A Project To Be Approved In Your Company."""
|
42 |
+
payload = {
|
43 |
+
"model": "mistralai/Mistral-7B-v0.1",
|
44 |
+
"messages": [
|
45 |
+
{
|
46 |
+
"role": "user",
|
47 |
+
"content": Prompt
|
48 |
+
}
|
49 |
+
],
|
50 |
+
"max_tokens": 500,
|
51 |
+
"temperature": 0.5,
|
52 |
+
}
|
53 |
+
|
54 |
+
headers = {
|
55 |
+
"content-type": "application/json",
|
56 |
+
"authorization": f"Bearer {apiKey}"
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
r = requests.post(url, json=payload, headers=headers)
|
61 |
+
data = r.json()
|
62 |
+
|
63 |
+
new_content = data['choices'][0]['message']['content']
|
64 |
+
|
65 |
+
text_to_remove = """<|im_end|>
|
66 |
+
<|im_start|>"""
|
67 |
+
|
68 |
+
# Check if the original text ends with the text to remove and remove it if it does
|
69 |
+
if new_content.endswith(text_to_remove):
|
70 |
+
content = new_content[:-len(text_to_remove)]
|
71 |
+
else:
|
72 |
+
content = new_content
|
73 |
+
|
74 |
+
return render_template("index.html", Result=content)
|
75 |
+
|
76 |
+
return render_template("index.html")
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
if __name__ == '__main__':
|
82 |
+
app.run(debug=True, host='0.0.0.0', port=7860)
|
config.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
class Config:
|
3 |
+
API_KEY = "sk-ckPYsnFiaiwu8rq5yf4Ek3qcTuDnDbQs"
|
model.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# import requests
|
2 |
+
# from config import Config
|
3 |
+
|
4 |
+
# url = "https://api.forefront.ai/v1/chat/completions"
|
5 |
+
# apiKey = Config.API_KEY
|
6 |
+
|
7 |
+
# name = "John Doe"
|
8 |
+
# Prompt = f"""From Now You Are A Tech Compnay Named 'GetIntern' Who Wanna Hire A Intern For {auto_Py, auto_Js, webDevPy, webDevJs} To Give InternShip.
|
9 |
+
# I'm {name},I Want Do That Internship.So Give Me A Project To Be Approved In Your Company."""
|
10 |
+
# payload = {
|
11 |
+
# "model": "mistralai/Mistral-7B-v0.1",
|
12 |
+
# "messages": [
|
13 |
+
# {
|
14 |
+
# "role": "user",
|
15 |
+
# "content": Prompt
|
16 |
+
# }
|
17 |
+
# ],
|
18 |
+
# "max_tokens": 500,
|
19 |
+
# "temperature": 0.5,
|
20 |
+
# }
|
21 |
+
|
22 |
+
# headers = {
|
23 |
+
# "content-type": "application/json",
|
24 |
+
# "authorization": f"Bearer {apiKey}"
|
25 |
+
# }
|
26 |
+
|
27 |
+
|
28 |
+
# r = requests.post(url, json=payload, headers=headers)
|
29 |
+
# data = r.json()
|
30 |
+
|
31 |
+
# content = data['choices'][0]['message']['content']
|
32 |
+
|
33 |
+
# if __name__ == "__main__":
|
34 |
+
# print(content)
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
flask
|
2 |
+
requests
|
static/index.css
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* {
|
2 |
+
box-sizing: border-box;
|
3 |
+
margin: 0;
|
4 |
+
padding: 0;
|
5 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
6 |
+
}
|
7 |
+
|
8 |
+
body {
|
9 |
+
background-color: #f3f4f6;
|
10 |
+
display: flex;
|
11 |
+
justify-content: center;
|
12 |
+
align-items: center;
|
13 |
+
height: 100vh;
|
14 |
+
}
|
15 |
+
|
16 |
+
.inter-form {
|
17 |
+
background-color: #ffffff;
|
18 |
+
border-radius: 10px;
|
19 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
20 |
+
padding: 30px;
|
21 |
+
width: 100%;
|
22 |
+
max-width: 500px;
|
23 |
+
}
|
24 |
+
|
25 |
+
.inter-form label {
|
26 |
+
font-weight: bold;
|
27 |
+
margin-bottom: 10px;
|
28 |
+
display: block;
|
29 |
+
color: #333333;
|
30 |
+
}
|
31 |
+
|
32 |
+
.inter-form input[type="text"] {
|
33 |
+
width: 100%;
|
34 |
+
padding: 12px;
|
35 |
+
margin-bottom: 20px;
|
36 |
+
border: 1px solid #dddddd;
|
37 |
+
border-radius: 6px;
|
38 |
+
font-size: 16px;
|
39 |
+
transition: border-color 0.3s ease;
|
40 |
+
}
|
41 |
+
|
42 |
+
.inter-form input[type="text"]:focus {
|
43 |
+
border-color: #007bff;
|
44 |
+
}
|
45 |
+
|
46 |
+
section {
|
47 |
+
margin-bottom: 20px;
|
48 |
+
}
|
49 |
+
|
50 |
+
section h4 {
|
51 |
+
margin-bottom: 15px;
|
52 |
+
color: #333333;
|
53 |
+
border-bottom: 2px solid #dddddd;
|
54 |
+
padding-bottom: 5px;
|
55 |
+
}
|
56 |
+
|
57 |
+
.checkbox-group {
|
58 |
+
display: flex;
|
59 |
+
flex-wrap: wrap;
|
60 |
+
gap: 10px;
|
61 |
+
}
|
62 |
+
|
63 |
+
.checkbox-group input[type="checkbox"] {
|
64 |
+
margin-right: 10px;
|
65 |
+
}
|
66 |
+
|
67 |
+
.checkbox-group label {
|
68 |
+
display: flex;
|
69 |
+
align-items: center;
|
70 |
+
color: #555555;
|
71 |
+
cursor: pointer;
|
72 |
+
}
|
73 |
+
|
74 |
+
button {
|
75 |
+
width: 100%;
|
76 |
+
padding: 15px;
|
77 |
+
background-color: #007bff;
|
78 |
+
border: none;
|
79 |
+
border-radius: 6px;
|
80 |
+
color: white;
|
81 |
+
font-size: 18px;
|
82 |
+
cursor: pointer;
|
83 |
+
transition: background-color 0.3s ease;
|
84 |
+
}
|
85 |
+
|
86 |
+
button:hover {
|
87 |
+
background-color: #0056b3;
|
88 |
+
}
|
89 |
+
|
90 |
+
.internship {
|
91 |
+
margin-top: 20px;
|
92 |
+
background-color: #f9f9f9;
|
93 |
+
border: 1px solid #dddddd;
|
94 |
+
border-radius: 6px;
|
95 |
+
padding: 15px;
|
96 |
+
max-height: 300px;
|
97 |
+
overflow-y: auto;
|
98 |
+
white-space: pre-wrap;
|
99 |
+
word-wrap: break-word;
|
100 |
+
color: #333333;
|
101 |
+
}
|
102 |
+
|
103 |
+
@media (max-width: 768px) {
|
104 |
+
.inter-form {
|
105 |
+
padding: 20px;
|
106 |
+
}
|
107 |
+
}
|
templates/index.html
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<link rel="stylesheet" href="static/index.css">
|
7 |
+
<title>GetIntern</title>
|
8 |
+
</head>
|
9 |
+
<body>
|
10 |
+
<form class="inter-form" action="/" method="post">
|
11 |
+
|
12 |
+
<label for="name">Name:</label>
|
13 |
+
<input type="text" id="name" name="name" required>
|
14 |
+
|
15 |
+
<section class="automation">
|
16 |
+
<h4>Automation</h4>
|
17 |
+
<div class="checkbox-group">
|
18 |
+
<input type="checkbox" name="auto-python" id="auto-python" value="True">
|
19 |
+
<label for="auto-python">Python</label>
|
20 |
+
|
21 |
+
<input type="checkbox" name="auto-javascript" id="auto-javascript" value="True">
|
22 |
+
<label for="auto-javascript">Javascript</label>
|
23 |
+
</div>
|
24 |
+
</section>
|
25 |
+
<section class="web-dev">
|
26 |
+
<h4>Web Development</h4>
|
27 |
+
<div class="checkbox-group">
|
28 |
+
<input type="checkbox" name="web-python" id="web-python" value="True">
|
29 |
+
<label for="web-python">Python</label>
|
30 |
+
|
31 |
+
<input type="checkbox" name="web-javascript" id="web-javascript" value="True">
|
32 |
+
<label for="web-javascript">Javascript</label>
|
33 |
+
</div>
|
34 |
+
</section>
|
35 |
+
<button type="submit">Get Internship</button>
|
36 |
+
|
37 |
+
<section class="internship">
|
38 |
+
<pre>{{ Result }}</pre>
|
39 |
+
</section>
|
40 |
+
|
41 |
+
</form>
|
42 |
+
</body>
|
43 |
+
</html>
|