Spaces:
Running

zyronxgg commited on
Commit
bd56fb0
·
verified ·
1 Parent(s): 2ffe308

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +48 -32
index.html CHANGED
@@ -31,8 +31,8 @@ body{background:#050505;color:#fff;display:flex;flex-direction:column;height:100
31
  <body>
32
  <div id="top"><h1>OR<span>VO</span></h1><div id="topRight"><span id="curModel">DRFT.4.R</span><button id="plusBtn" onclick="togglePop()">+</button></div></div>
33
  <div id="popup">
34
- <div class="sec">⭐ MODELS - Switch karo</div><div id="modelList"></div>
35
- <div class="sec">🖼️ IMAGE - ONLY 1 IMAGE</div>
36
  <div class="opt" onclick="makeImg('BMW car')"><span>🚗 BMW Car</span><span>IMAGE</span></div>
37
  <div class="opt" onclick="makeImg('Virat Kohli')"><span>🏏 Virat Kohli</span><span>IMAGE</span></div>
38
  <div class="opt" onclick="makeImg('Lion')"><span>🦁 Lion</span><span>IMAGE</span></div>
@@ -46,7 +46,7 @@ body{background:#050505;color:#fff;display:flex;flex-direction:column;height:100
46
  <div id="bottom"><input id="q" placeholder="Ask ORVO anything..."><button id="btn" onclick="go()">SEND</button></div>
47
  <script>
48
  var M='DRFT.4.R';
49
- var MODELS=[['DRFT.4.R','TOP • MAX'],['DRFT.1','FAST'],['DRFT.2','SMART'],['DRFT.2.0','TEXT+IMAGE'],['DRFT.3','BEAST'],['DRFT.3.5','PRO'],['DRFT.4','ULTRA'],['DRFT.4.P','IMAGE ONLY']];
50
  function renderModels(){var h='';for(var i=0;i<MODELS.length;i++){var m=MODELS[i];var cls='opt'+(m[0]===M?' active':'');h+='<div class="'+cls+'" onclick="setM(\''+m[0]+'\')"><span>'+(m[0]==='DRFT.4.R'?'👑 ':'')+m[0]+'</span><small>'+m[1]+'</small></div>';}document.getElementById('modelList').innerHTML=h;}
51
  renderModels();
52
  function togglePop(){document.getElementById('popup').classList.toggle('show');}
@@ -65,7 +65,7 @@ if(l.indexOf('story')!==-1) return '<b>Story - Karnataka ka Ladka</b><br>Shirva
65
  if(l.indexOf('bmw')!==-1) return '<b>BMW:</b><br>Germany ki luxury car. Famous: M4, i8, X5.';
66
  if(l.indexOf('cricket')!==-1||l.indexOf('virat')!==-1) return '<b>Cricket:</b><br>India ka popular game. Virat Kohli ko King Kohli bolte hai.';
67
  if(l.indexOf('science')!==-1) return '<b>Science</b><br>Science is the systematic discipline that builds and organises knowledge in the form of testable explanations about the universe.';
68
- return '<b>About '+q+':</b><br><br>'+q+' ka basic idea samjho.<br><br>Log isko roz use karte hai.<br><br>Input -> ORVO Engine -> Output.<br><br>Example: Jaise Karnataka ka ladka phone se ORVO bana raha hai.';
69
  }
70
  function makeHDImage(p){
71
  var c=document.createElement('canvas');c.width=1024;c.height=640;var x=c.getContext('2d');
@@ -77,43 +77,59 @@ x.font='bold 30px Arial';x.fillText(p.toUpperCase(),512,340);
77
  x.font='16px Arial';x.fillText('Made by ORVO • Built by 7zyron',512,600);
78
  return c.toDataURL('image/png');
79
  }
80
- // ===== IMAGE - ONLY 1 IMAGE - NO PICSUM - NO STACK =====
81
  function makeImg(topic){
82
  document.getElementById('popup').classList.remove('show');
83
  topic=topic.replace(/image of/gi,'').trim();
84
  addMsg('image of '+topic,'user');
85
  var seed=Date.now();
86
- var hd=makeHDImage(topic);
87
- // Pehle sirf 1 ORVO wali image dikhao
88
- var box=addMsg('<b>Image - '+topic.toUpperCase()+'</b><br><img class="real-img" id="img-'+seed+'" src="'+hd+'">','bot');
89
- // Ab 1 hi real photo se REPLACE karo, add nahi karna
90
- var searchTopic=topic;
91
- // BMW ke liye car hi search karo, bike nahi
92
- if(topic.toLowerCase().indexOf('bmw')!==-1 && topic.toLowerCase().indexOf('car')===-1) searchTopic='BMW car';
93
- fetch('https://commons.wikimedia.org/w/api.php?action=query&generator=search&gsrsearch='+encodeURIComponent(searchTopic)+'&gsrnamespace=6&prop=imageinfo&iiprop=url&iiurlwidth=1024&format=json&origin=*')
94
- .then(function(r){return r.json()}).then(function(d){
95
- if(d.query && d.query.pages){
96
- var pages=Object.values(d.query.pages);
97
- // Bike / Motorcycle wali photo skip karo agar car chahiye
98
- for(var i=0;i<pages.length;i++){
99
- var title=(pages[i].title||'').toLowerCase();
100
- if(searchTopic.toLowerCase().indexOf('car')!==-1 && (title.indexOf('motorcycle')!==-1 || title.indexOf('bike')!==-1 || title.indexOf('motorbike')!==-1)) continue;
101
- if(pages[i].imageinfo && pages[i].imageinfo[0].thumburl){
102
- document.getElementById('img-'+seed).src=pages[i].imageinfo[0].thumburl;
103
- return;
104
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
 
 
 
 
 
 
 
106
  }
107
- // Wikimedia me sahi nahi mila toh 1 hi Flickr photo se replace karo
108
- document.getElementById('img-'+seed).src='https://loremflickr.com/1024/640/'+encodeURIComponent(searchTopic)+'?lock='+seed;
109
- }).catch(function(){
110
- document.getElementById('img-'+seed).src='https://loremflickr.com/1024/640/'+encodeURIComponent(searchTopic)+'?lock='+seed;
111
- });
 
 
112
  }
113
- function tryLive(q,box){
114
- var kw=q.replace(/what|is|who|tell|me|about|define|explain|image|photo|picture|draw|of|in/gi,'').trim()||q;
115
- fetch('https://en.wikipedia.org/api/rest_v1/page/summary/'+encodeURIComponent(kw)).then(function(r){return r.json()}).then(function(d){if(d.extract&&d.extract.length>40){box.innerHTML=d.extract;}}).catch(function(){});
116
- fetch('https://ai.hackclub.com/chat/completions',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({messages:[{role:'user',content:'Answer simple in detail: '+q}]})}).then(function(r){return r.json()}).then(function(d){var t=d.choices&&d.choices[0]&&d.choices[0].message&&d.choices[0].message.content;if(t&&t.length>60){box.innerHTML=t.substring(0,1500);}}).catch(function(){});
117
  }
118
  function go(){
119
  var inp=document.getElementById('q');var q=inp.value.trim();if(!q)return;
 
31
  <body>
32
  <div id="top"><h1>OR<span>VO</span></h1><div id="topRight"><span id="curModel">DRFT.4.R</span><button id="plusBtn" onclick="togglePop()">+</button></div></div>
33
  <div id="popup">
34
+ <div class="sec">⭐ MODELS - Sab me Pollination + Wiki + DuckDuckGo</div><div id="modelList"></div>
35
+ <div class="sec">🖼️ IMAGE - ONLY 1 IMAGE - FLUX AI</div>
36
  <div class="opt" onclick="makeImg('BMW car')"><span>🚗 BMW Car</span><span>IMAGE</span></div>
37
  <div class="opt" onclick="makeImg('Virat Kohli')"><span>🏏 Virat Kohli</span><span>IMAGE</span></div>
38
  <div class="opt" onclick="makeImg('Lion')"><span>🦁 Lion</span><span>IMAGE</span></div>
 
46
  <div id="bottom"><input id="q" placeholder="Ask ORVO anything..."><button id="btn" onclick="go()">SEND</button></div>
47
  <script>
48
  var M='DRFT.4.R';
49
+ var MODELS=[['DRFT.4.R','TOP • MAX • ALL 3'],['DRFT.1','FAST • ALL 3'],['DRFT.2','SMART • ALL 3'],['DRFT.2.0','TEXT+IMAGE • ALL 3'],['DRFT.3','BEAST • ALL 3'],['DRFT.3.5','PRO'],['DRFT.4','ULTRA'],['DRFT.4.P','IMAGE ONLY • FLUX']];
50
  function renderModels(){var h='';for(var i=0;i<MODELS.length;i++){var m=MODELS[i];var cls='opt'+(m[0]===M?' active':'');h+='<div class="'+cls+'" onclick="setM(\''+m[0]+'\')"><span>'+(m[0]==='DRFT.4.R'?'👑 ':'')+m[0]+'</span><small>'+m[1]+'</small></div>';}document.getElementById('modelList').innerHTML=h;}
51
  renderModels();
52
  function togglePop(){document.getElementById('popup').classList.toggle('show');}
 
65
  if(l.indexOf('bmw')!==-1) return '<b>BMW:</b><br>Germany ki luxury car. Famous: M4, i8, X5.';
66
  if(l.indexOf('cricket')!==-1||l.indexOf('virat')!==-1) return '<b>Cricket:</b><br>India ka popular game. Virat Kohli ko King Kohli bolte hai.';
67
  if(l.indexOf('science')!==-1) return '<b>Science</b><br>Science is the systematic discipline that builds and organises knowledge in the form of testable explanations about the universe.';
68
+ return '⏳ Loading real answer...';
69
  }
70
  function makeHDImage(p){
71
  var c=document.createElement('canvas');c.width=1024;c.height=640;var x=c.getContext('2d');
 
77
  x.font='16px Arial';x.fillText('Made by ORVO • Built by 7zyron',512,600);
78
  return c.toDataURL('image/png');
79
  }
80
+ // ===== IMAGE - ONLY 1 IMAGE - POLLINATION FLUX =====
81
  function makeImg(topic){
82
  document.getElementById('popup').classList.remove('show');
83
  topic=topic.replace(/image of/gi,'').trim();
84
  addMsg('image of '+topic,'user');
85
  var seed=Date.now();
86
+ var box=addMsg('<b>Image - '+topic.toUpperCase()+'</b><br><small>⏳ AI bana raha hai...</small>','bot');
87
+ var aiUrl='https://image.pollinations.ai/prompt/'+encodeURIComponent('HD poster, cinematic, ultra detailed, '+topic+', dramatic lighting, 8k')+'?width=1024&height=1024&seed='+seed+'&model=flux&enhance=true&nologo=true';
88
+ box.innerHTML='<b>Image - '+topic.toUpperCase()+'</b><br><img class="real-img" src="'+aiUrl+'" onerror="this.onerror=null;this.src=\'https://loremflickr.com/1024/640/'+encodeURIComponent(topic)+'?lock='+seed+'\'">';
89
+ }
90
+ // ===== TEXT - FIXED: POLLINATION + WIKIPEDIA + DUCKDUCKGO - FOR ALL MODELS =====
91
+ function tryLive(q,box){
92
+ var kw=q.replace(/^(what|who|tell|define|explain|about)\s+(is|are|was|were|does|do)?\s*/i,'').replace(/\?$/,'').trim()||q;
93
+ var done=false;
94
+ function setAns(t){
95
+ if(done) return;
96
+ if(!t||t.length<40) return;
97
+ done=true;
98
+ box.innerHTML=t.substring(0,2000);
 
 
 
 
 
99
  }
100
+ // 1. WIKIPEDIA - Sabse pehle
101
+ fetch('https://en.wikipedia.org/api/rest_v1/page/summary/'+encodeURIComponent(kw)).then(function(r){return r.json()}).then(function(d){
102
+ if(d.extract&&d.extract.length>40) setAns(d.extract);
103
+ else tryDDG();
104
+ }).catch(function(){tryDDG();});
105
+ // 2. DUCKDUCKGO - Agar Wiki fail ho
106
+ function tryDDG(){
107
+ if(done) return;
108
+ fetch('https://api.duckduckgo.com/?q='+encodeURIComponent(q)+'&format=json&no_html=1&skip_disambig=1').then(function(r){return r.json()}).then(function(d){
109
+ var txt=d.AbstractText||'';
110
+ if(d.RelatedTopics && d.RelatedTopics[0] && d.RelatedTopics[0].Text) txt=txt||d.RelatedTopics[0].Text;
111
+ if(txt && txt.length>40) setAns(txt);
112
+ else tryPolli();
113
+ }).catch(function(){tryPolli();});
114
  }
115
+ // 3. POLLINATION TEXT AI - Agar dono fail ho, toh AI se jawab
116
+ function tryPolli(){
117
+ if(done) return;
118
+ fetch('https://text.pollinations.ai/'+encodeURIComponent('Answer in detail, simple language: '+q),{headers:{'Accept':'text/plain'}}).then(function(r){return r.text()}).then(function(t){
119
+ if(t && t.length>60 && t.toLowerCase().indexOf('limit')===-1) setAns(t);
120
+ else tryHack();
121
+ }).catch(function(){tryHack();});
122
  }
123
+ // 4. HACKCLUB - Last backup
124
+ function tryHack(){
125
+ if(done) return;
126
+ fetch('https://ai.hackclub.com/chat/completions',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({messages:[{role:'user',content:'Answer simple in detail: '+q}]})}).then(function(r){return r.json()}).then(function(d){
127
+ var t=d.choices&&d.choices[0]&&d.choices[0].message&&d.choices[0].message.content;
128
+ if(t&&t.length>60) setAns(t);
129
+ }).catch(function(){});
130
  }
131
+ // Agar 8 sec me kuch nahi aaya toh local wala hi dikhao
132
+ setTimeout(function(){if(!done){box.innerHTML='ISRO ke baare me live load nahi hua. Dobara try karo ya net check karo.';}},8000);
 
 
133
  }
134
  function go(){
135
  var inp=document.getElementById('q');var q=inp.value.trim();if(!q)return;