nisharg nargund commited on
Commit
66467a9
·
verified ·
1 Parent(s): e84b81f

Upload 10 files

Browse files
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, render_template, request
2
+ from langchain.prompts import PromptTemplate
3
+ from langchain.llms import CTransformers
4
+
5
+ app = Flask(__name__)
6
+
7
+ def get_llama_response(input_text, no_words, blog_style):
8
+ llm = CTransformers(model='models/llama-2-7b-chat.ggmlv3.q8_0.bin',
9
+ model_type='llama',
10
+ config={'max_new_tokens': 500,
11
+ 'temperature': 0.7})
12
+
13
+ template = """
14
+ Write a blog for {blog_style} job profile for a topic {input_text}
15
+ within {no_words} words.
16
+ """
17
+
18
+ prompt = PromptTemplate(input_variables=["blog_style", "input_text", "no_words"],
19
+ template=template)
20
+
21
+ response = llm(prompt.format(blog_style=blog_style, input_text=input_text, no_words=no_words))
22
+ return response
23
+
24
+ @app.route('/', methods=['GET', 'POST'])
25
+ def index():
26
+ if request.method == 'POST':
27
+ input_text = request.form['input_text']
28
+ no_words = request.form['no_words']
29
+ blog_style = request.form['blog_style']
30
+ response = get_llama_response(input_text, no_words, blog_style)
31
+ return render_template('index.html', response=response)
32
+ return render_template('index.html')
33
+
34
+ if __name__ == '__main__':
35
+ app.run(debug=True)
models/llama-2-7b-chat.ggmlv3.q8_0.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3bfdde943555c78294626a6ccd40184162d066d39774bd2c98dae24943d32cc3
3
+ size 7160799872
static/black.png ADDED
static/perfect.png ADDED
static/readme.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ readme
static/style.css ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body {
2
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
3
+ background-color: #000000;
4
+ margin: 0;
5
+ padding: 0;
6
+ display: flex;
7
+ justify-content: center;
8
+ align-items: center;
9
+ height: 100vh;
10
+ }
11
+
12
+ .container {
13
+ width: 450%; /* Increase the width for a larger main block */
14
+ max-width: 1800px; /* Set a maximum width to maintain readability */
15
+ padding: 60px;
16
+ background-color: rgb(0, 0, 0);
17
+ border-radius: 10px;
18
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
19
+ text-align: center;
20
+ background-image: url("vector.png"); /* Replace with your image path */
21
+ background-size: cover; /* Resize image to cover the container */
22
+ background-repeat: no-repeat; /* Don't repeat the image */
23
+ background-position: center; /* Center the image within the container */
24
+ }
25
+
26
+ h1 {
27
+ color: white;
28
+ font-size: 60px;
29
+ margin-bottom: 20px;
30
+ font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
31
+ }
32
+
33
+ form {
34
+ margin-top: 20px;
35
+ }
36
+
37
+ .front-frame {
38
+ background-image: url("{{ url_for('static', filename='blue.jpg') }}");
39
+ background-size: cover;
40
+ background-repeat: no-repeat;
41
+ background-position: center;
42
+ padding: 20px; /* Adjust padding as needed */
43
+ border-radius: 10px; /* Add border-radius for rounded corners */
44
+ }
45
+
46
+ label {
47
+ display: block;
48
+ margin-bottom: 15px;
49
+ color:white;
50
+ font-size: 20px;
51
+ font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
52
+ }
53
+
54
+ input,
55
+ select {
56
+ width: 100%;
57
+ padding: 15px;
58
+ margin-bottom: 20px;
59
+ border: 1px solid #ced4da;
60
+ border-radius: 4px;
61
+ box-sizing: border-box;
62
+ font-size: 16px;
63
+ }
64
+
65
+ .columns {
66
+ display: flex;
67
+ gap: 15px;
68
+ justify-content: space-between;
69
+ }
70
+
71
+ .column {
72
+ flex-grow: 1;
73
+ }
74
+
75
+ .generate-btn {
76
+ /*background-color:;*/
77
+ color:black;
78
+ font-family: Georgia, 'Times New Roman', Times, serif;
79
+ padding: 15px 25px;
80
+ border: none;
81
+ border-radius: 4px;
82
+ cursor: pointer;
83
+ font-size: 18px;
84
+ }
85
+
86
+ .generate-btn:hover {
87
+ background-color:lightblue;
88
+ }
89
+
90
+ .response {
91
+ margin-top: 20px;
92
+ background-color: rgb(214, 219, 214);
93
+ padding: 20px;
94
+ border-radius: 4px;
95
+ color: rgb(12, 12, 12);
96
+ font-size: 18px;
97
+ }
static/vector.png ADDED
templates/index.html ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <title>Blog Outline Generator</title>
7
+ <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
8
+ <!-- <style>
9
+ body {
10
+ background-image: url("{{ url_for('static', filename='bricks.jpg') }}");
11
+ background-size: cover;
12
+ background-repeat: no-repeat;
13
+ background-position: center;
14
+ }
15
+ </style> -->
16
+
17
+ </head>
18
+ <body>
19
+ <div class="container">
20
+ <img src="{{url_for('static', filename='perfect.png')}}" width="480" height="150" align="middle" />
21
+ <br>
22
+ <br>
23
+ <h1>AbstrAI ✒️</h1>
24
+ <br>
25
+ <form method="post" action="/">
26
+ <b><i><label for="input_text">Enter the topic: </label></i></b>
27
+ <input type="text" id="input_text" name="input_text" required>
28
+
29
+ <div class="columns">
30
+ <div class="column">
31
+ <b><i><label for="no_words">Enter the No of words: </label></i></b>
32
+ <input type="text" id="no_words" name="no_words" required>
33
+ </div>
34
+
35
+ <div class="column">
36
+ <b><i><label for="blog_style">Select the Industry or Audience</label></i></b>
37
+ <select id="blog_style" name="blog_style">
38
+ <option value="Technology">Technology</option>
39
+ <option value="Healthcare">Healthcare</option>
40
+ <option value="Education">Education</option>
41
+ <option value="Sports">Sports</option>
42
+ <option value="Entertainment">Entertainment</option>
43
+ <option value="Finance">Finance</option>
44
+ <option value="Travel">Travel</option>
45
+ <option value="Fashion">Fashion</option>
46
+ <!-- Add more options as needed -->
47
+ </select>
48
+ </div>
49
+
50
+ <!-- ... (remaining code) ... -->
51
+
52
+ </div>
53
+ <br>
54
+ <button type="submit" class="generate-btn">Generate!</button>
55
+ </form>
56
+
57
+ {% if response %}
58
+ <div class="response">
59
+ <p>{{ response }}</p>
60
+ </div>
61
+ {% endif %}
62
+ </div>
63
+ </body>
64
+ </html>
templates/main.jpg ADDED
templates/readme ADDED
@@ -0,0 +1 @@
 
 
1
+ readme