malvika2003 commited on
Commit
2574e89
·
verified ·
1 Parent(s): 2725a85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -14
app.py CHANGED
@@ -1,14 +1,19 @@
1
- from http.server import SimpleHTTPRequestHandler, HTTPServer
2
-
3
- class RequestHandler(SimpleHTTPRequestHandler):
4
- def __init__(self, *args, **kwargs):
5
- super().__init__(*args, directory='./', **kwargs)
6
-
7
- def run(server_class=HTTPServer, handler_class=RequestHandler, port=8000):
8
- server_address = ('', port)
9
- httpd = server_class(server_address, handler_class)
10
- print(f'Starting httpd on port {port}...')
11
- httpd.serve_forever()
12
-
13
- if __name__ == '__main__':
14
- run()
 
 
 
 
 
 
1
+ from flask import Flask, request, render_template
2
+
3
+ app = Flask(__name__)
4
+
5
+ @app.route('/')
6
+ def index():
7
+ return render_template('index.html')
8
+
9
+ @app.route('/predict', methods=['POST'])
10
+ def predict():
11
+ # Example of processing input
12
+ input_text = request.form['input_text']
13
+ # Perform some NLP tasks here (e.g., using transformers library)
14
+ output_text = "This is the output based on input: " + input_text
15
+ return render_template('index.html', output=output_text)
16
+
17
+ if __name__ == '__main__':
18
+ app.run(debug=True)
19
+