aaditya commited on
Commit
e73e36b
·
1 Parent(s): 023be4e

Add application file

Browse files
Files changed (2) hide show
  1. a.html +32 -0
  2. app.py +7 -1
a.html ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
4
+ <script type="text/javascript">
5
+ google.charts.load('current', {'packages':['corechart']});
6
+ google.charts.setOnLoadCallback(drawChart);
7
+ function drawChart()
8
+ {
9
+ var data = google.visualization.arrayToDataTable([
10
+ ['Label', 'Score'],
11
+ ['Joy', 0.9762780666351318],
12
+ ['Sadness', 0.006413798779249191],
13
+ ['Neutral', 0.005555825307965279],
14
+ ['Anger', 0.003799660596996546],
15
+ ['Surprise', 0.0037724850699305534],
16
+ ['Disgust', 0.0034403549507260323],
17
+ ['Fear', 0.0007397727458737791]
18
+ ]);
19
+
20
+ var options = {
21
+ title: 'Pie Chart',
22
+ is3D: true,
23
+ };
24
+ var chart = new google.visualization.PieChart(document.getElementById('piechart'));
25
+ chart.draw(data, options);
26
+ }
27
+ </script>
28
+ </head>
29
+ <body>
30
+ <div id="piechart" style="width: 900px; height: 500px;"></div>
31
+ </body>
32
+ </html>
app.py CHANGED
@@ -37,7 +37,13 @@ class Datas(Resource):
37
 
38
  try:
39
  return_output = len(encoder.encode(prompt_))
40
- return {'status': '1', 'token_legth': return_output}
 
 
 
 
 
 
41
  except Exception as e:
42
  return {'status': '-1'}
43
 
 
37
 
38
  try:
39
  return_output = len(encoder.encode(prompt_))
40
+
41
+ # old_prompt + new_input
42
+ total_consumed = 561 + return_output
43
+ return {'status': '1', 'token_legth': return_output,
44
+ 'character_length': len(return_output),
45
+ 'remaining_tokens': 4000 - total_consumed}
46
+
47
  except Exception as e:
48
  return {'status': '-1'}
49