gautam-shetty commited on
Commit
951a2cd
1 Parent(s): e53d003

streamlit integration

Browse files
Files changed (1) hide show
  1. app.py +29 -13
app.py CHANGED
@@ -1,18 +1,34 @@
1
 
2
- from flask import Flask, request, render_template
3
- from predict import Predict
 
 
 
 
 
 
4
 
5
- app = Flask(__name__)
 
 
 
 
 
 
 
 
 
 
6
 
7
- @app.route('/')
8
- def home():
9
- return render_template('index.html')
 
10
 
11
- @app.route('/predict', methods=['POST'])
12
- def predict():
13
- feature_list = request.form.to_dict()
14
- result = Predict().predict(feature_list['code'])
15
- return render_template('index.html', prediction_text=result)
16
 
17
- if __name__ == "__main__":
18
- app.run(debug=True, use_reloader=False, port='8080')
 
1
 
2
+ # from flask import Flask, request, render_template
3
+ # from predict import Predict
4
+
5
+ # app = Flask(__name__)
6
+
7
+ # @app.route('/')
8
+ # def home():
9
+ # return render_template('index.html')
10
 
11
+ # @app.route('/predict', methods=['POST'])
12
+ # def predict():
13
+ # feature_list = request.form.to_dict()
14
+ # result = Predict().predict(feature_list['code'])
15
+ # return render_template('index.html', prediction_text=result)
16
+
17
+ # if __name__ == "__main__":
18
+ # app.run(debug=True, use_reloader=False, port='8080')
19
+
20
+ import streamlit as st
21
+ from predict import Predict
22
 
23
+ def page():
24
+ st.title("jRefactoring")
25
+ codeSnippet = st.text_input('Enter Java code here', "public class hello { ... }")
26
+ st.text("")
27
 
28
+ if st.button('Check'):
29
+ if(codeSnippet!=""):
30
+ st.text("")
31
+ result = Predict().predict(codeSnippet)
32
+ st.write(result)
33
 
34
+ page()