Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,25 @@ import torch
|
|
| 10 |
from huggingface_hub import hf_hub_url, cached_download, HfApi
|
| 11 |
import base64
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Set your Hugging Face API key here
|
| 14 |
# hf_token = "YOUR_HUGGING_FACE_API_KEY" # Replace with your actual token
|
| 15 |
# Get Hugging Face token from secrets.toml - this line should already be in the main code
|
|
|
|
| 10 |
from huggingface_hub import hf_hub_url, cached_download, HfApi
|
| 11 |
import base64
|
| 12 |
|
| 13 |
+
# Add the new HTML code below
|
| 14 |
+
custom_html = '''
|
| 15 |
+
<div style='position:fixed;bottom:0;left:0;width:100%;'>
|
| 16 |
+
<iframe width="100%" scrolling="no" title="CodeGPT Widget" frameborder="0" allowtransparency sandbox="" allowfullscreen="" data-widget-id="c265505c-e667-4af2-b492-291da888ee7c" src="https://widget.codegpt.co/chat-widget.js"></iframe>
|
| 17 |
+
</div>'''
|
| 18 |
+
|
| 19 |
+
# Update the markdown function to accept custom HTML code
|
| 20 |
+
def markdown_with_custom_html(md, html):
|
| 21 |
+
md_content = md
|
| 22 |
+
if html:
|
| 23 |
+
return f"{md_content}\n\n{html}"
|
| 24 |
+
else:
|
| 25 |
+
return md_content
|
| 26 |
+
|
| 27 |
+
# Usage example:
|
| 28 |
+
markdown_text = "Compare model responses with me!"
|
| 29 |
+
markdown_with_custom_html(markdown_text, custom_html)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
# Set your Hugging Face API key here
|
| 33 |
# hf_token = "YOUR_HUGGING_FACE_API_KEY" # Replace with your actual token
|
| 34 |
# Get Hugging Face token from secrets.toml - this line should already be in the main code
|