Yaron Koresh commited on
Commit
fef1dcd
·
verified ·
1 Parent(s): 887de96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -5
app.py CHANGED
@@ -100,8 +100,25 @@ footer {
100
 
101
  js="""
102
  function custom(){
103
- document.querySelector("div#prompt input").setAttribute("maxlength","38")
104
- document.querySelector("div#prompt2 input").setAttribute("maxlength","38")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
  """
107
 
@@ -218,8 +235,8 @@ def handle_generate(*_inp):
218
 
219
  inp = list(_inp)
220
 
221
- inp[1] = translate(inp[1],"english")
222
- inp[2] = translate(inp[2],"english")
223
 
224
  if inp[2] != "":
225
  inp[2] = ", " + inp[2]
@@ -255,7 +272,7 @@ def ui():
255
  global result
256
  with gr.Blocks(theme=gr.themes.Citrus(),css=css,js=js) as demo:
257
  gr.Markdown(f"""
258
- # MULTI-LANGUAGE MP4/PNG CREATOR
259
  """)
260
  with gr.Row():
261
  title = gr.Textbox(
 
100
 
101
  js="""
102
  function custom(){
103
+ document.querySelector("div#prompt input").addEventListener("keydown",function(e){
104
+ e.target.setAttribute("last_value",e.target.value);
105
+ });
106
+ document.querySelector("div#prompt input").addEventListener("input",function(e){
107
+ if( e.target.value.toString().match(/[^ a-zA-Z,]/gsm) ){
108
+ e.target.value = e.target.getAttribute("last_value");
109
+ e.target.removeAttribute("last_value");
110
+ }
111
+ });
112
+ \
113
+ document.querySelector("div#prompt2 input").addEventListener("keydown",function(e){
114
+ e.target.setAttribute("last_value",e.target.value);
115
+ });
116
+ document.querySelector("div#prompt2 input").addEventListener("input",function(e){
117
+ if( e.target.value.toString().match(/[^ a-zA-Z,]/gsm) ){
118
+ e.target.value = e.target.getAttribute("last_value");
119
+ e.target.removeAttribute("last_value");
120
+ }
121
+ });
122
  }
123
  """
124
 
 
235
 
236
  inp = list(_inp)
237
 
238
+ #inp[1] = translate(inp[1],"english")
239
+ #inp[2] = translate(inp[2],"english")
240
 
241
  if inp[2] != "":
242
  inp[2] = ", " + inp[2]
 
272
  global result
273
  with gr.Blocks(theme=gr.themes.Citrus(),css=css,js=js) as demo:
274
  gr.Markdown(f"""
275
+ # MP4/PNG Creator
276
  """)
277
  with gr.Row():
278
  title = gr.Textbox(