ConradLax commited on
Commit
aaeedf0
·
1 Parent(s): da3b513

test: render html template

Browse files
Files changed (3) hide show
  1. Dockerfile +0 -1
  2. main.py +6 -5
  3. templates/index.html +7 -2
Dockerfile CHANGED
@@ -7,7 +7,6 @@ WORKDIR /code
7
 
8
  COPY ./requirements.txt /code/requirements.txt
9
 
10
- RUN python ./onLaunch.py
11
 
12
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
13
 
 
7
 
8
  COPY ./requirements.txt /code/requirements.txt
9
 
 
10
 
11
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
 
main.py CHANGED
@@ -5,10 +5,11 @@ app = Flask(__name__)
5
 
6
  @app.route('/')
7
  def index():
8
- sentiment_analysis = pipeline("sentiment-analysis")
9
- result = sentiment_analysis("I absolutely love this product!")
10
 
11
- return render_template('index.html', res=jsonify({"sentiment": result[0]["label"], "score": result[0]["score"]}))
 
12
 
13
  import torch
14
  from transformers import pipeline
@@ -19,8 +20,8 @@ from PIL import Image
19
 
20
 
21
 
22
- classifier_doctype_processor = DonutProcessor.from_pretrained("calumpianojericho/donutclassifier_acctdocs_by_doctype")
23
- classifier_doctype_model = VisionEncoderDecoderModel.from_pretrained("calumpianojericho/donutclassifier_acctdocs_by_doctype")
24
 
25
  # # Load the sentiment analysis model
26
  # sentiment_analysis = pipeline("sentiment-analysis")
 
5
 
6
  @app.route('/')
7
  def index():
8
+ # sentiment_analysis = pipeline("sentiment-analysis")
9
+ # result = sentiment_analysis("I absolutely love this product!")
10
 
11
+ return render_template('index.html', name="aaa");
12
+ # return render_template('index.html', res=jsonify({"sentiment": result[0]["label"], "score": result[0]["score"]}))
13
 
14
  import torch
15
  from transformers import pipeline
 
20
 
21
 
22
 
23
+ # classifier_doctype_processor = DonutProcessor.from_pretrained("calumpianojericho/donutclassifier_acctdocs_by_doctype")
24
+ # classifier_doctype_model = VisionEncoderDecoderModel.from_pretrained("calumpianojericho/donutclassifier_acctdocs_by_doctype")
25
 
26
  # # Load the sentiment analysis model
27
  # sentiment_analysis = pipeline("sentiment-analysis")
templates/index.html CHANGED
@@ -9,7 +9,7 @@
9
  </head>
10
  <body>
11
  <h1>Welcome!</h1>
12
- <ul>
13
  {% for key, value in res.items() recursive %}
14
  <li>
15
  {% if value is string %}
@@ -20,7 +20,12 @@
20
  {% endif %}
21
  </li>
22
  {% endfor %}
23
- </ul>
 
 
 
 
 
24
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
25
  </body>
26
  </html>
 
9
  </head>
10
  <body>
11
  <h1>Welcome!</h1>
12
+ <!-- <ul>
13
  {% for key, value in res.items() recursive %}
14
  <li>
15
  {% if value is string %}
 
20
  {% endif %}
21
  </li>
22
  {% endfor %}
23
+ </ul> -->
24
+ {% if name %}
25
+ <h1>Hello {{ name }}!</h1>
26
+ {% else %}
27
+ <h1>Hello, World!</h1>
28
+ {% endif %}
29
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
30
  </body>
31
  </html>