jaynopponep commited on
Commit
7ba9378
·
1 Parent(s): fcb22a6

fixing app.py

Browse files
.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
.idea/CTIIC-Plagiarism-Detector.iml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="Flask">
4
+ <option name="enabled" value="true" />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$" />
8
+ <orderEntry type="jdk" jdkName="Python 3.12" jdkType="Python SDK" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ </component>
11
+ <component name="TemplatesService">
12
+ <option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
13
+ <option name="TEMPLATE_FOLDERS">
14
+ <list>
15
+ <option value="$MODULE_DIR$/templates" />
16
+ </list>
17
+ </option>
18
+ </component>
19
+ </module>
.idea/discord.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="DiscordProjectSettings">
4
+ <option name="show" value="ASK" />
5
+ <option name="description" value="" />
6
+ </component>
7
+ </project>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="Python 3.12" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
7
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/CTIIC-Plagiarism-Detector.iml" filepath="$PROJECT_DIR$/.idea/CTIIC-Plagiarism-Detector.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
app.py CHANGED
@@ -1,10 +1,17 @@
1
- from flask import Flask, render_template
 
2
 
3
  app = Flask(__name__)
4
 
5
 
6
- @app.route('/')
7
- def home(): # put application's code here
 
 
 
 
 
 
8
  return render_template('home.html')
9
 
10
 
 
1
+ from flask import Flask, render_template, request, jsonify
2
+ import model # Import your model module
3
 
4
  app = Flask(__name__)
5
 
6
 
7
+ @app.route('/', methods=['GET', 'POST'])
8
+ def home():
9
+ if request.method == 'POST':
10
+ data = request.json
11
+ user_input = data['text']
12
+ # Use your model to classify the text
13
+ prediction = model.classify_text(user_input)
14
+ return jsonify({'classification': prediction})
15
  return render_template('home.html')
16
 
17
 
templates/home.html CHANGED
@@ -1,82 +1,98 @@
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>AI Detector</title>
7
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
8
- <style>
9
- body, html {
10
- height: 100%;
11
- margin: 0;
12
- }
13
- .bg {
14
- background-image: url('your-background-image.jpg'); /* Replace with your image URL */
15
- height: 100%;
16
- background-position: center;
17
- background-repeat: no-repeat;
18
- background-size: cover;
19
- }
20
- .container {
21
- position: absolute;
22
- left: 50%;
23
- top: 50%;
24
- transform: translate(-50%, -50%);
25
- text-align: center;
26
- }
27
- .title {
28
- font-size: 3em; /* Makes the title larger */
29
- }
30
- .submit-btn {
31
- font-size: 1.2em; /* Makes the button text larger */
32
- padding: 10px 24px; /* Larger button padding */
33
- }
34
- .auto-expand {
35
- overflow-y: hidden;
36
- resize: none; /* Prevents resizing manually */
37
- min-height: 50px; /* Minimum height */
38
- }
39
- </style>
40
  </head>
41
  <body>
42
 
43
  <div class="bg">
44
- <div class="container">
45
- <h1 class="title">AI Detector</h1>
46
- <form id="aiForm">
47
- <div class="form-group">
48
- <label for="inputData">Baljinder and Jay for ICCAE</label>
49
- <textarea class="form-control auto-expand" id="inputData" placeholder="Enter data"></textarea>
50
- </div>
51
- <button type="submit" class="btn btn-primary submit-btn">Submit</button>
52
- </form>
53
- </div>
 
54
  </div>
55
 
56
- <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
 
57
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.bundle.min.js"></script>
58
  <script>
59
- // Function to resize textarea based on content
60
- function resizeTextarea (id) {
61
- const textarea = document.getElementById(id);
62
- textarea.style.height = 'auto';
63
- textarea.style.height = (textarea.scrollHeight) + 'px';
64
- }
65
 
66
- // Initial resize
67
- resizeTextarea('inputData');
68
-
69
- // Resize on input
70
- $('#inputData').on('input', function () {
71
  resizeTextarea('inputData');
72
- });
73
 
74
- $('#aiForm').submit(function(event) {
75
- event.preventDefault();
76
- var input = $('#inputData').val();
77
- alert('Input received: ' + input);
78
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  </script>
80
 
81
  </body>
82
- </html>
 
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>AI Detector</title>
7
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
8
+ <style>
9
+ body, html {
10
+ height: 100%;
11
+ margin: 0;
12
+ }
13
+ .bg {
14
+ background-image: url('your-background-image.jpg'); /* Replace with your image URL */
15
+ height: 100%;
16
+ background-position: center;
17
+ background-repeat: no-repeat;
18
+ background-size: cover;
19
+ }
20
+ .container {
21
+ position: absolute;
22
+ left: 50%;
23
+ top: 50%;
24
+ transform: translate(-50%, -50%);
25
+ text-align: center;
26
+ }
27
+ .title {
28
+ font-size: 3em; /* Makes the title larger */
29
+ }
30
+ .submit-btn {
31
+ font-size: 1.2em; /* Makes the button text larger */
32
+ padding: 10px 24px; /* Larger button padding */
33
+ }
34
+ .auto-expand {
35
+ overflow-y: hidden;
36
+ resize: none; /* Prevents resizing manually */
37
+ min-height: 50px; /* Minimum height */
38
+ }
39
+ </style>
40
  </head>
41
  <body>
42
 
43
  <div class="bg">
44
+ <div class="container">
45
+ <h1 class="title">AI Detector</h1>
46
+ <form id="aiForm">
47
+ <div class="form-group">
48
+ <label for="inputData">Baljinder and Jay for ICCAE</label>
49
+ <textarea class="form-control auto-expand" id="inputData" placeholder="Enter data"></textarea>
50
+ </div>
51
+ <button type="submit" class="btn btn-primary submit-btn">Submit</button>
52
+ </form>
53
+ <p id="result" class="lead"></p>
54
+ </div>
55
  </div>
56
 
57
+ <!-- Load jQuery from CDN -->
58
+ <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
59
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.bundle.min.js"></script>
60
  <script>
61
+ // Function to resize textarea based on content
62
+ function resizeTextarea (id) {
63
+ const textarea = document.getElementById(id);
64
+ textarea.style.height = 'auto';
65
+ textarea.style.height = (textarea.scrollHeight) + 'px';
66
+ }
67
 
68
+ // Initial resize
 
 
 
 
69
  resizeTextarea('inputData');
 
70
 
71
+ // Resize on input
72
+ $('#inputData').on('input', function () {
73
+ resizeTextarea('inputData');
74
+ });
75
+
76
+ $('#aiForm').submit(function(event) {
77
+ event.preventDefault();
78
+ var inputText = $('#inputData').val();
79
+
80
+ // AJAX call to send data to server
81
+ $.ajax({
82
+ type: "POST",
83
+ url: "/", // Assuming your Flask route is '/'
84
+ contentType: "application/json;charset=UTF-8",
85
+ data: JSON.stringify({text: inputText}),
86
+ success: function(response) {
87
+ // Display the result
88
+ $('#result').text('Classified as: ' + response.classification);
89
+ },
90
+ error: function(error) {
91
+ console.log(error);
92
+ }
93
+ });
94
+ });
95
  </script>
96
 
97
  </body>
98
+ </html>