Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Llama3 free api</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/styles/default.min.css"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/languages/python.min.js"></script> | |
<style> | |
body{ | |
background-color: black; | |
color: white; | |
} | |
pre, code { | |
width: 90%; | |
margin: 0 auto; | |
font-size: 18px; | |
} | |
#response{ | |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
} | |
a{ | |
color: aquamarine; | |
} | |
</style> | |
<script> | |
document.addEventListener('DOMContentLoaded', (event) => { | |
hljs.highlightAll(); | |
}); | |
function runCode() { | |
var xhr = new XMLHttpRequest(); | |
document.getElementById('btn').disabled = true | |
xhr.open("POST", "https://fumes-api.onrender.com/llama3", true); | |
xhr.setRequestHeader("Content-Type", "application/json"); | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState === 3) { // Streaming response | |
var responseText = xhr.responseText.substring(xhr.lastIndex); | |
var responseParagraph = document.getElementById('response'); | |
responseParagraph.innerText += responseText; | |
xhr.lastIndex = xhr.responseText.length; // Update last index | |
} else if (xhr.readyState === 4 && xhr.status === 200) { // Final response | |
var responseText = xhr.responseText.substring(xhr.lastIndex); | |
var responseParagraph = document.getElementById('response'); | |
responseParagraph.innerText += responseText; | |
} | |
document.getElementById('btn').disabled = false | |
}; | |
xhr.lastIndex = 0; // Initialize last index | |
var data = JSON.stringify({ | |
prompt: `{ | |
systemPrompt: 'RolePlay as Sugar Daddy Issac Newton', | |
user: 'hi', | |
Assistant: 'Hello, I am Sugar Daddy Issac Newton', | |
user: 'tell me about Calculus in 50 to 60 words' | |
}`, | |
temperature: 0.75, | |
topP: 0.9, | |
maxTokens: 600 | |
}); | |
xhr.send(data); | |
} | |
</script> | |
</head> | |
<body> | |
<h2> Llama3 70b free api! </h2> | |
<a href="https://discord.gg/whhTdtPfKc">Join Discord for any Support or Assistance </a> | |
<h3> Rate Limit: 10requests per Second </h3> | |
<button onclick="runCode()" id="btn">Run Code!!</button> | |
<p id="response"></p> | |
<pre><code id="codeBlock" class="language-python"> | |
import requests | |
response = requests.post('https://fumes-api.onrender.com/llama3', | |
json={ | |
'prompt': """{ | |
'systemPrompt': 'RolePlay as Issac Newton', | |
'user': 'hi', | |
'Assistant': 'Hello, I am Issac Newton', | |
'user': 'tell me about Calculus' | |
}""", | |
"temperature":0.75, | |
"topP":0.9, | |
"maxTokens": 600 | |
}, stream=True) | |
for chunk in response.iter_content(chunk_size=1024): | |
if chunk: | |
print(chunk.decode('utf-8')) | |
</code></pre> | |
</body> | |
</html> | |