Spaces:
Running
Running
Download index.html from Hani-al/api-prototype-before-ar: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/spaces/Hani-al/api-prototype-before-ar/resolve/main/index.html
- Command line
-
hf download hf://spaces/Hani-al/api-prototype-before-ar/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Hani-al/api-prototype-before-ar/resolve/main/index.html
2.23 kB
| <html lang="ar" dir="rtl"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>API Prototype - Before</title><style>body{font:16px Arial;background:#f4f4f5;color:#222;margin:0}main{max-width:850px;margin:auto;padding:22px}.box{background:#fff;padding:22px;border:1px solid #ddd;border-radius:10px;margin-top:18px}label{display:block;margin:12px 0;font-weight:bold}input{width:100%;padding:10px;box-sizing:border-box;margin-top:5px;border:1px solid #bbb;border-radius:6px}button{padding:11px 15px;border:0;border-radius:6px;background:#555;color:#fff;font-weight:bold;margin:5px 3px 0 0}pre,#out{white-space:pre-wrap;background:#f1f1f1;padding:14px;border-radius:6px;direction:ltr;text-align:left}#history{white-space:pre-line}</style><main><h1>النموذج الأولي لـ API — قبل التحديث</h1><p>نسخة أولية بسيطة: إدخال قيم وإرجاع تحليل وصفي.</p><section class="box"><label>القيمة الأولى<input id="a" type="number"></label><label>القيمة الثانية<input id="b" type="number"></label><button onclick="run()">إرسال الطلب</button><button onclick="show()">السجل</button><h3>طلب API تجريبي</h3><pre id="req">POST /api/analyze</pre><div id="out">لم يتم إرسال طلب.</div><div id="history">لا توجد اختبارات.</div></section></main><script>let k='api_before';function run(){let x=+a.value,y=+b.value;if(!Number.isFinite(x)||!Number.isFinite(y)){out.textContent='خطأ: أدخل رقمين صالحين';return}let r={time:new Date().toLocaleString('ar'),a:x,b:y,sum:x+y,avg:(x+y)/2};let h=JSON.parse(localStorage.getItem(k)||'[]');h.push(r);localStorage.setItem(k,JSON.stringify(h));req.textContent='POST /api/analyze\n'+JSON.stringify({a:x,b:y},null,2);out.textContent='200 OK\n'+JSON.stringify({sum:r.sum,average:r.avg},null,2);show()}function show(){let h=JSON.parse(localStorage.getItem(k)||'[]');history.textContent='سجل الاختبارات ('+h.length+'):\n'+h.slice(-8).map((r,i)=>(i+1)+'. '+r.time+' | مجموع '+r.sum).join('\n')}show()</script></script></div></pre></h3></button></label></section></p></h1></main></style></title></html> |