Spaces:
Sleeping
Sleeping
Vlad Bastina commited on
Commit ·
8bacc70
1
Parent(s): ad6a882
style css
Browse files
app.py
CHANGED
|
@@ -65,6 +65,18 @@ LANGUAGES = ["russian", "romanian", "english", "german", "french", "spanish"]
|
|
| 65 |
|
| 66 |
# --- Core Functions (Adapted from your script) ---
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
# Global variable to hold the configured model
|
| 69 |
gemini_model = None
|
| 70 |
|
|
@@ -339,6 +351,8 @@ def create_txt_from_text(translated_text):
|
|
| 339 |
return None
|
| 340 |
|
| 341 |
|
|
|
|
|
|
|
| 342 |
# --- Streamlit App UI ---
|
| 343 |
st.title("📄 Document Translator")
|
| 344 |
|
|
|
|
| 65 |
|
| 66 |
# --- Core Functions (Adapted from your script) ---
|
| 67 |
|
| 68 |
+
def load_css(file_name):
|
| 69 |
+
"""Loads a CSS file and injects it into the Streamlit app."""
|
| 70 |
+
try:
|
| 71 |
+
css_path = Path(__file__).parent / file_name
|
| 72 |
+
with open(css_path) as f:
|
| 73 |
+
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
|
| 74 |
+
# st.info(f"Loaded CSS: {file_name}") # Optional: uncomment for debugging
|
| 75 |
+
except FileNotFoundError:
|
| 76 |
+
st.error(f"CSS file not found: {file_name}. Make sure it's in the same directory as app.py.")
|
| 77 |
+
except Exception as e:
|
| 78 |
+
st.error(f"Error loading CSS file {file_name}: {e}")
|
| 79 |
+
|
| 80 |
# Global variable to hold the configured model
|
| 81 |
gemini_model = None
|
| 82 |
|
|
|
|
| 351 |
return None
|
| 352 |
|
| 353 |
|
| 354 |
+
load_css("style.css")
|
| 355 |
+
|
| 356 |
# --- Streamlit App UI ---
|
| 357 |
st.title("📄 Document Translator")
|
| 358 |
|
style.css
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Target the main block container of the Streamlit app */
|
| 2 |
+
.stApp {
|
| 3 |
+
background-color: #f0f2f6; /* Light grey background */
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
/* Style the sidebar */
|
| 7 |
+
[data-testid="stSidebar"] {
|
| 8 |
+
background-color: #e8eaf6; /* Lighter purple/blue */
|
| 9 |
+
border-right: 2px solid #1a237e; /* Dark blue border */
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
/* Style buttons in the sidebar */
|
| 13 |
+
[data-testid="stSidebar"] .stButton>button {
|
| 14 |
+
background-color: #3f51b5; /* Indigo */
|
| 15 |
+
color: white;
|
| 16 |
+
border-radius: 8px;
|
| 17 |
+
border: none;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
[data-testid="stSidebar"] .stButton>button:hover {
|
| 21 |
+
background-color: #1a237e; /* Darker Indigo on hover */
|
| 22 |
+
color: white;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/* Style the main title */
|
| 26 |
+
h1 {
|
| 27 |
+
color: #2c3e50; /* Dark grey/blue */
|
| 28 |
+
text-align: center;
|
| 29 |
+
font-family: 'Arial', sans-serif; /* Example font */
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/* Style subheaders */
|
| 33 |
+
h2, h3 {
|
| 34 |
+
color: #3f51b5; /* Indigo */
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/* Style download buttons specifically */
|
| 38 |
+
.stDownloadButton>button {
|
| 39 |
+
background-color: #4CAF50; /* Green */
|
| 40 |
+
color: white;
|
| 41 |
+
padding: 10px 20px;
|
| 42 |
+
border-radius: 5px;
|
| 43 |
+
border: none;
|
| 44 |
+
}
|
| 45 |
+
.stDownloadButton>button:hover {
|
| 46 |
+
background-color: #388E3C; /* Darker Green */
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/* Style info boxes */
|
| 50 |
+
.stAlert.st-alert.stInfo {
|
| 51 |
+
border-left-color: #3f51b5 !important; /* Use !important carefully if needed */
|
| 52 |
+
background-color: #e8eaf6;
|
| 53 |
+
color: #1a237e;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/* You might need to inspect elements in your browser's developer tools
|
| 57 |
+
to find the correct selectors for specific Streamlit elements. */
|