Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,16 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from
|
| 3 |
from pvlib import pvsystem, location
|
| 4 |
import pandas as pd
|
| 5 |
import numpy as np
|
| 6 |
|
| 7 |
# Translator setup
|
| 8 |
-
translator =
|
| 9 |
|
| 10 |
# Function to handle translation
|
| 11 |
def translate(text, lang_code):
|
| 12 |
try:
|
| 13 |
-
|
| 14 |
-
return translated.text
|
| 15 |
except Exception:
|
| 16 |
return text # Fallback to original text
|
| 17 |
|
|
@@ -91,3 +90,4 @@ if st.button(translate("Calculate Recommendations", lang_code)):
|
|
| 91 |
|
| 92 |
|
| 93 |
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from googletrans_new import google_translator
|
| 3 |
from pvlib import pvsystem, location
|
| 4 |
import pandas as pd
|
| 5 |
import numpy as np
|
| 6 |
|
| 7 |
# Translator setup
|
| 8 |
+
translator = google_translator()
|
| 9 |
|
| 10 |
# Function to handle translation
|
| 11 |
def translate(text, lang_code):
|
| 12 |
try:
|
| 13 |
+
return translator.translate(text, lang_tgt=lang_code)
|
|
|
|
| 14 |
except Exception:
|
| 15 |
return text # Fallback to original text
|
| 16 |
|
|
|
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
+
|