sadik1111 commited on
Commit
e2793cb
·
verified ·
1 Parent(s): 4d22c9e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +20 -10
index.html CHANGED
@@ -1,39 +1,49 @@
1
  <!DOCTYPE html>
2
- <html>
3
  <head>
4
  <meta charset="utf-8">
5
  <title>Gemma API Connector</title>
6
  <style>
7
  body { font-family: Arial, sans-serif; max-width: 600px; margin: 40px auto; padding: 20px; }
8
- textarea { width: 100%; height: 100px; margin-bottom: 10px; padding: 10px; }
9
- button { padding: 10px 20px; background-color: #ffd21e; border: none; font-weight: bold; cursor: pointer; }
10
- #output { margin-top: 20px; padding: 10px; background: #f4f4f4; white-space: pre-wrap; }
 
11
  </style>
12
  </head>
13
  <body>
14
 
15
- <h2>Gemma Model Assistant</h2>
16
- <textarea id="promptInput" placeholder="أدخل نصاً هنا..."></textarea><br>
 
 
 
 
 
 
17
  <button onclick="generateText()">إرسال</button>
18
 
19
  <h3>النتيجة:</h3>
20
  <div id="output">بانتظار الإدخال...</div>
21
 
22
  <script>
23
- // ضع Access Token الخاص بك هنا
24
- const HF_TOKEN = "hf_YourAccessTokenHere";
25
-
26
  async function generateText() {
 
27
  const prompt = document.getElementById("promptInput").value;
28
  const outputDiv = document.getElementById("output");
29
 
 
 
 
 
 
30
  outputDiv.innerText = "جاري التحميل...";
31
 
32
  try {
33
  const response = await fetch("https://api-inference.huggingface.co/models/google/gemma-2b-it", {
34
  method: "POST",
35
  headers: {
36
- "Authorization": `Bearer ${HF_TOKEN}`,
37
  "Content-Type": "application/json"
38
  },
39
  body: JSON.stringify({ inputs: prompt })
 
1
  <!DOCTYPE html>
2
+ <html lang="ar" dir="rtl">
3
  <head>
4
  <meta charset="utf-8">
5
  <title>Gemma API Connector</title>
6
  <style>
7
  body { font-family: Arial, sans-serif; max-width: 600px; margin: 40px auto; padding: 20px; }
8
+ input[type="password"], textarea { width: 100%; margin-bottom: 15px; padding: 10px; box-sizing: border-box; }
9
+ textarea { height: 100px; }
10
+ button { padding: 10px 20px; background-color: #ffd21e; border: none; font-weight: bold; cursor: pointer; width: 100%; }
11
+ #output { margin-top: 20px; padding: 15px; background: #f4f4f4; border-radius: 5px; white-space: pre-wrap; }
12
  </style>
13
  </head>
14
  <body>
15
 
16
+ <h2>مساعد Gemma</h2>
17
+
18
+ <label>رمز الوصول (Access Token):</label>
19
+ <input type="password" id="tokenInput" placeholder="أدخل رمز hf_... الخاص بك هنا">
20
+
21
+ <label>النص (Prompt):</label>
22
+ <textarea id="promptInput" placeholder="أدخل نصاً هنا..."></textarea>
23
+
24
  <button onclick="generateText()">إرسال</button>
25
 
26
  <h3>النتيجة:</h3>
27
  <div id="output">بانتظار الإدخال...</div>
28
 
29
  <script>
 
 
 
30
  async function generateText() {
31
+ const token = document.getElementById("tokenInput").value.trim();
32
  const prompt = document.getElementById("promptInput").value;
33
  const outputDiv = document.getElementById("output");
34
 
35
+ if (!token) {
36
+ outputDiv.innerText = "يرجى إدخال Access Token أولاً.";
37
+ return;
38
+ }
39
+
40
  outputDiv.innerText = "جاري التحميل...";
41
 
42
  try {
43
  const response = await fetch("https://api-inference.huggingface.co/models/google/gemma-2b-it", {
44
  method: "POST",
45
  headers: {
46
+ "Authorization": `Bearer ${token}`,
47
  "Content-Type": "application/json"
48
  },
49
  body: JSON.stringify({ inputs: prompt })