nepto commited on
Commit
8a8ffb4
·
verified ·
1 Parent(s): 9833fa3

undefined - Initial Deployment

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +100 -18
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Calculator
3
- emoji: 👀
4
- colorFrom: red
5
- colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: calculator
3
+ emoji: 🐳
4
+ colorFrom: gray
5
+ colorTo: gray
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,101 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </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>Minimal Scientific Calculator</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ .btn {
10
+ transition: all 0.2s ease;
11
+ }
12
+ .btn:active {
13
+ transform: scale(0.95);
14
+ }
15
+ #display {
16
+ height: 2.5rem;
17
+ }
18
+ </style>
19
+ </head>
20
+ <body class="bg-gray-100 min-h-screen flex items-center justify-center">
21
+ <div class="bg-white rounded-xl shadow-xl overflow-hidden w-80">
22
+ <div class="p-4 bg-gray-50">
23
+ <input id="display" class="w-full text-right text-2xl font-medium bg-transparent outline-none" readonly>
24
+ </div>
25
+
26
+ <div class="grid grid-cols-4 gap-1 p-2 bg-gray-100">
27
+ <button onclick="clearAll()" class="btn bg-red-500 hover:bg-red-600 text-white font-medium py-3 rounded-lg">C</button>
28
+ <button onclick="backspace()" class="btn bg-gray-300 hover:bg-gray-400 py-3 rounded-lg">←</button>
29
+ <button onclick="append('%')" class="btn bg-gray-300 hover:bg-gray-400 py-3 rounded-lg">%</button>
30
+ <button onclick="append('/')" class="btn bg-blue-500 hover:bg-blue-600 text-white font-medium py-3 rounded-lg">/</button>
31
+
32
+ <button onclick="append('7')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg">7</button>
33
+ <button onclick="append('8')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg">8</button>
34
+ <button onclick="append('9')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg">9</button>
35
+ <button onclick="append('*')" class="btn bg-blue-500 hover:bg-blue-600 text-white font-medium py-3 rounded-lg">×</button>
36
+
37
+ <button onclick="append('4')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg">4</button>
38
+ <button onclick="append('5')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg">5</button>
39
+ <button onclick="append('6')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg">6</button>
40
+ <button onclick="append('-')" class="btn bg-blue-500 hover:bg-blue-600 text-white font-medium py-3 rounded-lg">-</button>
41
+
42
+ <button onclick="append('1')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg">1</button>
43
+ <button onclick="append('2')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg">2</button>
44
+ <button onclick="append('3')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg">3</button>
45
+ <button onclick="append('+')" class="btn bg-blue-500 hover:bg-blue-600 text-white font-medium py-3 rounded-lg">+</button>
46
+
47
+ <button onclick="append('0')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg col-span-2">0</button>
48
+ <button onclick="append('.')" class="btn bg-white hover:bg-gray-100 py-3 rounded-lg">.</button>
49
+ <button onclick="calculate()" class="btn bg-green-500 hover:bg-green-600 text-white font-medium py-3 rounded-lg">=</button>
50
+
51
+ <!-- Scientific functions -->
52
+ <button onclick="append('Math.sin(')" class="btn bg-purple-100 hover:bg-purple-200 py-3 rounded-lg text-sm">sin</button>
53
+ <button onclick="append('Math.cos(')" class="btn bg-purple-100 hover:bg-purple-200 py-3 rounded-lg text-sm">cos</button>
54
+ <button onclick="append('Math.tan(')" class="btn bg-purple-100 hover:bg-purple-200 py-3 rounded-lg text-sm">tan</button>
55
+ <button onclick="append('Math.sqrt(')" class="btn bg-purple-100 hover:bg-purple-200 py-3 rounded-lg text-sm">√</button>
56
+
57
+ <button onclick="append('Math.log(')" class="btn bg-purple-100 hover:bg-purple-200 py-3 rounded-lg text-sm">log</button>
58
+ <button onclick="append('Math.PI')" class="btn bg-purple-100 hover:bg-purple-200 py-3 rounded-lg text-sm">π</button>
59
+ <button onclick="append('Math.pow(')" class="btn bg-purple-100 hover:bg-purple-200 py-3 rounded-lg text-sm">x^y</button>
60
+ <button onclick="append(')')" class="btn bg-purple-100 hover:bg-purple-200 py-3 rounded-lg text-sm">)</button>
61
+ </div>
62
+ </div>
63
+
64
+ <script>
65
+ const display = document.getElementById('display');
66
+ let currentInput = '';
67
+
68
+ function append(value) {
69
+ currentInput += value;
70
+ display.value = currentInput;
71
+ }
72
+
73
+ function clearAll() {
74
+ currentInput = '';
75
+ display.value = '';
76
+ }
77
+
78
+ function backspace() {
79
+ currentInput = currentInput.slice(0, -1);
80
+ display.value = currentInput;
81
+ }
82
+
83
+ function calculate() {
84
+ try {
85
+ // Replace visual operators with JavaScript operators
86
+ let expression = currentInput
87
+ .replace(/×/g, '*')
88
+ .replace(/÷/g, '/');
89
+
90
+ // Evaluate the expression
91
+ const result = eval(expression);
92
+ currentInput = result.toString();
93
+ display.value = currentInput;
94
+ } catch (error) {
95
+ display.value = 'Error';
96
+ currentInput = '';
97
+ }
98
+ }
99
+ </script>
100
+ </body>
101
  </html>
prompts.txt ADDED
File without changes