Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import streamlit as st
|
| 3 |
from groq import Groq
|
|
@@ -97,11 +100,43 @@ def store_code_in_faiss(chunks):
|
|
| 97 |
faiss_index.add(np.array(embeddings, dtype=np.float32))
|
| 98 |
return faiss_index
|
| 99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
st.title("Microcontroller Code Generator", anchor="title")
|
| 101 |
|
| 102 |
# Step 1: Display Custom Image
|
| 103 |
-
# Use the image URL from
|
| 104 |
-
image_url = "https://imgur.com/
|
| 105 |
st.image(image_url, caption="Custom Image", use_container_width=True)
|
| 106 |
|
| 107 |
st.write("Select a microcontroller and provide your code requirements to generate code.")
|
|
@@ -132,13 +167,6 @@ def store_code_in_faiss(chunks):
|
|
| 132 |
st.subheader("Generated Code", anchor="generated-code")
|
| 133 |
st.code(code)
|
| 134 |
|
| 135 |
-
# Add logo to the top bar using the new Imgur image URL
|
| 136 |
-
st.markdown("""
|
| 137 |
-
<div class="top-bar-logo">
|
| 138 |
-
<img src="https://i.imgur.com/CBm5exE.png" alt="Logo" width="150">
|
| 139 |
-
</div>
|
| 140 |
-
""", unsafe_allow_html=True)
|
| 141 |
-
|
| 142 |
# Run the Streamlit App
|
| 143 |
if __name__ == "__main__":
|
| 144 |
main()
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
|
| 4 |
import os
|
| 5 |
import streamlit as st
|
| 6 |
from groq import Groq
|
|
|
|
| 100 |
faiss_index.add(np.array(embeddings, dtype=np.float32))
|
| 101 |
return faiss_index
|
| 102 |
|
| 103 |
+
# Streamlit App
|
| 104 |
+
def main():
|
| 105 |
+
# Custom styling for the app using markdown
|
| 106 |
+
st.markdown("""
|
| 107 |
+
<style>
|
| 108 |
+
.title {
|
| 109 |
+
font-size: 40px;
|
| 110 |
+
font-weight: bold;
|
| 111 |
+
color: #FF6347;
|
| 112 |
+
}
|
| 113 |
+
.subheader {
|
| 114 |
+
font-size: 24px;
|
| 115 |
+
color: #4CAF50;
|
| 116 |
+
}
|
| 117 |
+
.generated-code {
|
| 118 |
+
background-color: #f0f0f0;
|
| 119 |
+
padding: 10px;
|
| 120 |
+
border-radius: 10px;
|
| 121 |
+
}
|
| 122 |
+
.sidebar .sidebar-content {
|
| 123 |
+
background-color: #f4f4f4;
|
| 124 |
+
}
|
| 125 |
+
.stButton button {
|
| 126 |
+
background-color: #008CBA;
|
| 127 |
+
color: white;
|
| 128 |
+
border-radius: 8px;
|
| 129 |
+
padding: 10px;
|
| 130 |
+
font-size: 16px;
|
| 131 |
+
}
|
| 132 |
+
</style>
|
| 133 |
+
""", unsafe_allow_html=True)
|
| 134 |
+
|
| 135 |
st.title("Microcontroller Code Generator", anchor="title")
|
| 136 |
|
| 137 |
# Step 1: Display Custom Image
|
| 138 |
+
# Use the image URL from Hugging Face Files Section
|
| 139 |
+
image_url = "https://imgur.com/a/fq3S6xr.png"
|
| 140 |
st.image(image_url, caption="Custom Image", use_container_width=True)
|
| 141 |
|
| 142 |
st.write("Select a microcontroller and provide your code requirements to generate code.")
|
|
|
|
| 167 |
st.subheader("Generated Code", anchor="generated-code")
|
| 168 |
st.code(code)
|
| 169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
# Run the Streamlit App
|
| 171 |
if __name__ == "__main__":
|
| 172 |
main()
|