Spaces:
Sleeping
Sleeping
acumplid
commited on
Commit
•
5688ad2
1
Parent(s):
88b2c32
Implement detecting max input characters
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ from meteocat_appv4 import generate
|
|
8 |
|
9 |
load_dotenv()
|
10 |
|
11 |
-
|
12 |
SHOW_MODEL_PARAMETERS_IN_UI = os.environ.get("SHOW_MODEL_PARAMETERS_IN_UI", default=True)
|
13 |
MAX_NEW_TOKENS = int(os.environ.get("MAX_NEW_TOKENS", default=200))
|
14 |
|
@@ -30,14 +30,9 @@ def submit_input(input_, repetition_penalty, temperature):
|
|
30 |
|
31 |
|
32 |
def change_interactive(text):
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
return gr.update(interactive = True), gr.update(interactive = False)
|
37 |
-
elif input_state.strip() != "":
|
38 |
-
return gr.update(interactive = True), gr.update(interactive = True)
|
39 |
-
else:
|
40 |
-
return gr.update(interactive = False), gr.update(interactive = False)
|
41 |
|
42 |
def clean():
|
43 |
return (
|
|
|
8 |
|
9 |
load_dotenv()
|
10 |
|
11 |
+
MAX_INPUT_CHARACTERS= int(os.environ.get("MAX_INPUT_CHARACTERS", default=200))
|
12 |
SHOW_MODEL_PARAMETERS_IN_UI = os.environ.get("SHOW_MODEL_PARAMETERS_IN_UI", default=True)
|
13 |
MAX_NEW_TOKENS = int(os.environ.get("MAX_NEW_TOKENS", default=200))
|
14 |
|
|
|
30 |
|
31 |
|
32 |
def change_interactive(text):
|
33 |
+
if len(text.strip()) > MAX_INPUT_CHARACTERS:
|
34 |
+
return gr.update(interactive = True), gr.update(interactive = False)
|
35 |
+
return gr.update(interactive = True), gr.update(interactive = True)
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
def clean():
|
38 |
return (
|