Skip to content

Commit

Permalink
Add Interface mode tab
Browse files Browse the repository at this point in the history
  • Loading branch information
oobabooga committed Mar 16, 2023
1 parent b501722 commit 4d64a57
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 182 deletions.
2 changes: 1 addition & 1 deletion css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ svg {
ol li p, ul li p {
display: inline-block;
}
#main, #settings, #chat-settings {
#main, #parameters, #chat-settings, #interface-mode {
border: 0;
}
20 changes: 12 additions & 8 deletions modules/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ def load_extensions():
for i, name in enumerate(shared.args.extensions):
if name in available_extensions:
print(f'Loading the extension "{name}"... ', end='')
exec(f"import extensions.{name}.script")
state[name] = [True, i]
print('Ok.')
try:
exec(f"import extensions.{name}.script")
state[name] = [True, i]
print('Ok.')
except:
print('Fail.')

# This iterator returns the extensions in the order specified in the command-line
def iterator():
Expand Down Expand Up @@ -42,8 +45,9 @@ def create_extensions_block():
extension.params[param] = shared.settings[_id]

# Creating the extension ui elements
with gr.Box(elem_id="extensions"):
gr.Markdown("Extensions")
for extension, name in iterator():
if hasattr(extension, "ui"):
extension.ui()
if len(state) > 0:
with gr.Box(elem_id="extensions"):
gr.Markdown("Extensions")
for extension, name in iterator():
if hasattr(extension, "ui"):
extension.ui()
3 changes: 3 additions & 0 deletions modules/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
# Generation input parameters
input_params = []

# For restarting the interface
need_restart = False

settings = {
'max_new_tokens': 200,
'max_new_tokens_min': 1,
Expand Down
Loading

0 comments on commit 4d64a57

Please sign in to comment.