Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -38,6 +38,9 @@ def translate(text,lang):
|
|
38 |
|
39 |
if text == "" or lang == "":
|
40 |
return ""
|
|
|
|
|
|
|
41 |
|
42 |
user_agents = [
|
43 |
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
|
@@ -126,8 +129,8 @@ footer {
|
|
126 |
|
127 |
js="""
|
128 |
function custom(){
|
129 |
-
document.querySelector("div#prompt input").setAttribute("maxlength","
|
130 |
-
document.querySelector("div#prompt2 input").setAttribute("maxlength","
|
131 |
}
|
132 |
"""
|
133 |
|
@@ -145,15 +148,14 @@ with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo:
|
|
145 |
with gr.Row():
|
146 |
prompt = gr.Textbox(
|
147 |
elem_id="prompt",
|
148 |
-
placeholder="
|
149 |
container=False,
|
150 |
rtl=True,
|
151 |
max_lines=1
|
152 |
)
|
153 |
-
with gr.Row():
|
154 |
prompt2 = gr.Textbox(
|
155 |
elem_id="prompt2",
|
156 |
-
placeholder="Forbidden Content",
|
157 |
container=False,
|
158 |
rtl=True,
|
159 |
max_lines=1
|
|
|
38 |
|
39 |
if text == "" or lang == "":
|
40 |
return ""
|
41 |
+
|
42 |
+
if len(text) > 38:
|
43 |
+
raise Exception("Translation Error: Too long text!")
|
44 |
|
45 |
user_agents = [
|
46 |
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
|
|
|
129 |
|
130 |
js="""
|
131 |
function custom(){
|
132 |
+
document.querySelector("div#prompt input").setAttribute("maxlength","30");
|
133 |
+
document.querySelector("div#prompt2 input").setAttribute("maxlength","30");
|
134 |
}
|
135 |
"""
|
136 |
|
|
|
148 |
with gr.Row():
|
149 |
prompt = gr.Textbox(
|
150 |
elem_id="prompt",
|
151 |
+
placeholder="(Required Content)",
|
152 |
container=False,
|
153 |
rtl=True,
|
154 |
max_lines=1
|
155 |
)
|
|
|
156 |
prompt2 = gr.Textbox(
|
157 |
elem_id="prompt2",
|
158 |
+
placeholder="(Forbidden Content)",
|
159 |
container=False,
|
160 |
rtl=True,
|
161 |
max_lines=1
|