Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,9 +3,7 @@ import streamlit as st
|
|
| 3 |
import requests
|
| 4 |
import os
|
| 5 |
import re
|
| 6 |
-
|
| 7 |
-
from weasyprint import HTML
|
| 8 |
-
from io import BytesIO
|
| 9 |
|
| 10 |
# Environment Setup
|
| 11 |
HF_API_URL = "https://router.huggingface.co/novita/v3/openai/chat/completions"
|
|
@@ -109,7 +107,6 @@ if st.button(":mag_right: Evaluate Prompt"):
|
|
| 109 |
# Add scroll anchor
|
| 110 |
st.markdown("<a name='result'></a>", unsafe_allow_html=True)
|
| 111 |
|
| 112 |
-
|
| 113 |
# Render result with dark theme-friendly style
|
| 114 |
st.markdown(f"""
|
| 115 |
<div style='background-color:#1e1e1e; color:#f0f0f0; padding:20px; border-radius:10px; border: 1px solid #444; font-family: monospace; font-size: 15px;'>
|
|
@@ -117,15 +114,9 @@ if st.button(":mag_right: Evaluate Prompt"):
|
|
| 117 |
</div>
|
| 118 |
""", unsafe_allow_html=True)
|
| 119 |
|
| 120 |
-
#
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
# Create PDF from HTML
|
| 124 |
-
pdf = HTML(string=html_content).write_pdf()
|
| 125 |
|
| 126 |
-
# Create download button for PDF
|
| 127 |
-
st.download_button("Download PDF", pdf, file_name="evaluation.pdf", mime="application/pdf")
|
| 128 |
-
|
| 129 |
# Toast + Balloons + Auto-scroll
|
| 130 |
st.toast("✅ Evaluation complete!", icon="🤖")
|
| 131 |
st.balloons()
|
|
|
|
| 3 |
import requests
|
| 4 |
import os
|
| 5 |
import re
|
| 6 |
+
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Environment Setup
|
| 9 |
HF_API_URL = "https://router.huggingface.co/novita/v3/openai/chat/completions"
|
|
|
|
| 107 |
# Add scroll anchor
|
| 108 |
st.markdown("<a name='result'></a>", unsafe_allow_html=True)
|
| 109 |
|
|
|
|
| 110 |
# Render result with dark theme-friendly style
|
| 111 |
st.markdown(f"""
|
| 112 |
<div style='background-color:#1e1e1e; color:#f0f0f0; padding:20px; border-radius:10px; border: 1px solid #444; font-family: monospace; font-size: 15px;'>
|
|
|
|
| 114 |
</div>
|
| 115 |
""", unsafe_allow_html=True)
|
| 116 |
|
| 117 |
+
# Download button
|
| 118 |
+
st.download_button("Download Evaluation", result, file_name="evaluation.txt")
|
|
|
|
|
|
|
|
|
|
| 119 |
|
|
|
|
|
|
|
|
|
|
| 120 |
# Toast + Balloons + Auto-scroll
|
| 121 |
st.toast("✅ Evaluation complete!", icon="🤖")
|
| 122 |
st.balloons()
|