File size: 4,259 Bytes
2dcc01d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Bharat AI</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    body {
      margin: 0;
      background: #121212;
      font-family: 'Segoe UI', sans-serif;
      color: #fff;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding-top: 20px;
    }
    img.logo {
      max-width: 180px;
      border-radius: 12px;
      margin-bottom: 20px;
    }
    h1 {
      color: #00ffc8;
    }
    .chatbox {
      width: 90%;
      max-width: 700px;
      background: #1e1e1e;
      border-radius: 10px;
      padding: 15px;
      margin-bottom: 20px;
      overflow-y: auto;
      height: 400px;
      box-shadow: 0 0 10px rgba(0, 255, 200, 0.4);
    }
    .input-area, .upload-area {
      display: flex;
      width: 90%;
      max-width: 700px;
      margin-bottom: 10px;
    }
    input[type="text"], input[type="file"], input[type="password"], input[type="email"] {
      flex: 1;
      padding: 10px;
      border: none;
      border-radius: 8px;
      font-size: 16px;
      margin-right: 10px;
    }
    button {
      background: #00ffc8;
      border: none;
      padding: 10px 15px;
      cursor: pointer;
      border-radius: 8px;
      font-size: 16px;
    }
    #authSection, #mainApp { display: none; }
  </style>
</head>
<body>
  <img src="logo.jpg" alt="Bharat AI Logo" class="logo">
  <h1>BHARAT AI</h1>

  <div id="authSection">
    <input type="email" id="email" placeholder="Enter email">
    <input type="password" id="password" placeholder="Create a password">
    <button onclick="registerUser()">Register & Login</button>
  </div>

  <div id="mainApp">
    <div class="chatbox" id="chatbox"></div>
    <div class="input-area">
      <input type="text" id="userInput" placeholder="Ask something..." />
      <button onclick="sendMessage()">Send</button>
    </div>
    <div class="upload-area">
      <input type="file" id="mediaInput" />
      <button onclick="uploadMedia()">Upload</button>
    </div>
    <div class="input-area">
      <button onclick="generateImage()">🖼 Generate Image</button>
      <button onclick="generateVideo()">🎥 Generate Video</button>
    </div>
  </div>

  <script>
    window.onload = () => {
      document.getElementById('authSection').style.display = 'block';
    };

    function registerUser() {
      const email = document.getElementById('email').value;
      const pass = document.getElementById('password').value;
      if (email && pass) {
        localStorage.setItem('user', JSON.stringify({ email, pass }));
        document.getElementById('authSection').style.display = 'none';
        document.getElementById('mainApp').style.display = 'block';
      } else {
        alert("Enter both email and password.");
      }
    }

    async function sendMessage() {
      const input = document.getElementById('userInput');
      const chatbox = document.getElementById('chatbox');
      const userMessage = input.value.trim();
      if (!userMessage) return;
      chatbox.innerHTML += `<div><strong>You:</strong> ${userMessage}</div>`;
      input.value = "";

      const response = await fetch("https://api-inference.huggingface.co/models/microsoft/Phi-3-mini-4k-instruct", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer hf_HF_TOKEN_HERE"
        },
        body: JSON.stringify({
          inputs: userMessage
        })
      });

      const data = await response.json();
      const reply = data?.[0]?.generated_text || "Sorry, no response.";
      chatbox.innerHTML += `<div><strong>Bharat AI:</strong> ${reply}</div>`;
      chatbox.scrollTop = chatbox.scrollHeight;
    }

    function uploadMedia() {
      const file = document.getElementById('mediaInput').files[0];
      if (!file) return alert("Select a file first.");
      alert(`Media '${file.name}' uploaded successfully.`); // Simulated
    }

    function generateImage() {
      alert("Image generation will be added soon. This is a placeholder.");
    }

    function generateVideo() {
      alert("Video generation requires advanced setup. Coming soon!");
    }
  </script>
</body>
</html>