Spaces:
Running
Running
Update index.html
Browse files- index.html +7 -3
index.html
CHANGED
@@ -375,13 +375,16 @@ header:hover .scroll-indicator .arrow {
|
|
375 |
</section>
|
376 |
<section class="section">
|
377 |
<h2>Example Usage</h2>
|
378 |
-
|
379 |
import openai
|
380 |
-
|
381 |
-
|
|
|
|
|
382 |
# Use the custom API endpoint
|
383 |
openai.api_base = "https://parthsadaria-lokiai.hf.space"
|
384 |
openai.api_key = api_key
|
|
|
385 |
def chat_with_gpt():
|
386 |
try:
|
387 |
response = openai.ChatCompletion.create(
|
@@ -392,6 +395,7 @@ def chat_with_gpt():
|
|
392 |
print(response['choices'][0]['message']['content'])
|
393 |
except Exception as e:
|
394 |
print(f"Error: {e}")
|
|
|
395 |
chat_with_gpt()
|
396 |
</code></pre>
|
397 |
</section>
|
|
|
375 |
</section>
|
376 |
<section class="section">
|
377 |
<h2>Example Usage</h2>
|
378 |
+
<pre><code class="language-python">
|
379 |
import openai
|
380 |
+
|
381 |
+
# Set up the API key and endpoint
|
382 |
+
api_key = '' # Add your API key here
|
383 |
+
|
384 |
# Use the custom API endpoint
|
385 |
openai.api_base = "https://parthsadaria-lokiai.hf.space"
|
386 |
openai.api_key = api_key
|
387 |
+
|
388 |
def chat_with_gpt():
|
389 |
try:
|
390 |
response = openai.ChatCompletion.create(
|
|
|
395 |
print(response['choices'][0]['message']['content'])
|
396 |
except Exception as e:
|
397 |
print(f"Error: {e}")
|
398 |
+
|
399 |
chat_with_gpt()
|
400 |
</code></pre>
|
401 |
</section>
|