acecalisto3 commited on
Commit
611325e
·
verified ·
1 Parent(s): 3ca564e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +363 -270
app.py CHANGED
@@ -1,16 +1,11 @@
1
  import os
2
  import subprocess
3
  import random
4
- import json
5
- from datetime import datetime
6
- import uuid # Import the uuid library
7
-
8
- from huggingface_hub import InferenceClient, cached_download, hf_hub_url
9
  import gradio as gr
10
-
11
  from safe_search import safe_search
12
- from i_search import google, i_search as i_s
13
-
14
  from agent import (
15
  ACTION_PROMPT,
16
  ADD_PROMPT,
@@ -24,274 +19,372 @@ from agent import (
24
  TASK_PROMPT,
25
  UNDERSTAND_TEST_RESULTS_PROMPT,
26
  )
27
-
28
  from utils import parse_action, parse_file_content, read_python_module_structure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
- class App:
31
- def __init__(self):
32
- self.app_state = {"components": []}
33
- self.terminal_history = ""
34
- self.components_registry = {
35
- "Button": {
36
- "properties": {
37
- "label": "Click Me",
38
- "onclick": ""
39
- },
40
- "description": "A clickable button",
41
- "code_snippet": "gr.Button(value='{{label}}', variant='primary')"
42
- },
43
- "Text Input": {
44
- "properties": {
45
- "value": "",
46
- "placeholder": "Enter text"
47
- },
48
- "description": "A field for entering text",
49
- "code_snippet": "gr.Textbox(label='{{placeholder}}')"
50
- },
51
- "Image": {
52
- "properties": {
53
- "src": "#",
54
- "alt": "Image"
55
- },
56
- "description": "Displays an image",
57
- "code_snippet": "gr.Image(label='{{alt}}')"
58
- },
59
- "Dropdown": {
60
- "properties": {
61
- "choices": ["Option 1", "Option 2"],
62
- "value": ""
63
- },
64
- "description": "A dropdown menu for selecting options",
65
- "code_snippet": "gr.Dropdown(choices={{choices}}, label='Dropdown')"
66
- }
67
- }
68
- self.nlp_model_names = [
69
- "google/flan-t5-small",
70
- "Qwen/CodeQwen1.5-7B-Chat-GGUF",
71
- "bartowski/Codestral-22B-v0.1-GGUF",
72
- "bartowski/AutoCoder-GGUF"
73
- ]
74
- self.nlp_models = []
75
- self.initialize_nlp_models()
76
-
77
- def initialize_nlp_models(self):
78
- for nlp_model_name in self.nlp_model_names:
79
- try:
80
- cached_download(hf_hub_url(nlp_model_name, revision="main"))
81
- self.nlp_models.append(InferenceClient(nlp_model_name))
82
- except:
83
- self.nlp_models.append(None)
84
-
85
- def get_nlp_response(self, input_text, model_index):
86
- if self.nlp_models[model_index]:
87
- response = self.nlp_models[model_index].text_generation(input_text)
88
- return response.generated_text
 
 
 
 
 
 
 
 
 
 
89
  else:
90
- return "NLP model not available."
91
-
92
- def update_app_canvas(self):
93
- components_html = "".join([f"<div>Component ID: {component['id']}, Type: {component['type']}, Properties: {component['properties']}</div>" for component in self.app_state["components"]])
94
- return components_html
95
-
96
- def add_component(self, component_type, properties=None):
97
- try:
98
- new_component = {
99
- "type": component_type,
100
- "properties": properties or {},
101
- "id": str(uuid.uuid4()) # Assign a unique ID using UUID
102
- }
103
- self.app_state["components"].append(new_component)
104
- except Exception as e:
105
- print(f"Error adding component: {e}")
106
-
107
- def run_terminal_command(self, command, *args):
108
- output = ""
109
- try:
110
- if command.startswith("add "):
111
- component_type = command.split("add ")[1]
112
- return self.add_component(component_type)
113
- elif command.startswith("search "):
114
- query = command.split("search ")[1]
115
- return google(query)
116
- elif command.startswith("i search "):
117
- query = command.split("i search ")[1]
118
- return i_s(query)
119
- elif command.startswith("safe search "):
120
- query = command.split("safesearch ")[1]
121
- return safe_search(query)
122
- elif command.startswith("read "):
123
- file_path = command.split("read ")[1]
124
- return parse_file_content(file_path)
125
- elif command == "task":
126
- return TASK_PROMPT
127
- elif command == "modify":
128
- return MODIFY_PROMPT
129
- elif command == "log":
130
- return LOG_PROMPT
131
- elif command.startswith("understand test results "):
132
- test_results = command.split("understand test results ")[1]
133
- return self.understand_test_results(test_results)
134
- elif command.startswith("compress history"):
135
- return self.compress_history(self.terminal_history)
136
- elif command == "help":
137
- return self.get_help_message()
138
- elif command == "exit":
139
- exit()
140
  else:
141
- output = subprocess.check_output(command, shell=True).decode("utf-8")
142
- except Exception as e:
143
- output = str(e)
144
- return output or "No output\n"
145
-
146
- def compress_history(self, history):
147
- compressed_history = ""
148
- lines = history.strip().split("\n")
149
- for line in lines:
150
- if not line.strip().startswith("#"):
151
- compressed_history += line + "\n"
152
- return compressed_history
153
-
154
- def understand_test_results(self, test_results):
155
- return UNDERSTAND_TEST_RESULTS_PROMPT
156
-
157
- def get_help_message(self):
158
- return """
159
- Available commands:
160
- - add [component_type]: Add a component to the app canvas
161
- - search [query]: Perform a Google search
162
- - i search [query]: Perform an intelligent search
163
- - safe search [query]: Perform a safe search
164
- - read [file_path]: Read and parse the content of a Python module
165
- - task: Prompt for a task to perform
166
- - modify: Prompt to modify a component property
167
- - log: Prompt to log a response
168
- - understand test results [test_results]: Understand test results
169
- - compress history: Compress the terminal history by removing comments
170
- - help: Show this help message
171
- - exit: Exit the program
172
- """
173
-
174
- def process_input(self, input_text):
175
- if input_text.strip().startswith("/"):
176
- command = input_text.strip().lstrip("/")
177
- output = self.run_terminal_command(command)
178
- self.terminal_history += f"{input_text}\n{output}\n"
179
- return output, ""
180
  else:
181
- model_index = random.randint(0, len(self.nlp_models)-1)
182
- response = self.get_nlp_response(input_text, model_index)
183
- component_id, action, property_name, property_value = parse_action(response)
184
- if component_id:
185
- component = next((comp for comp in self.app_state["components"] if comp["id"] == component_id), None)
186
- if component:
187
- if action == "update":
188
- component["properties"][property_name] = property_value
189
- return self.update_app_canvas(), f"System: Updated property '{property_name}' of component with ID {component_id}\n"
190
- elif action == "remove":
191
- self.app_state["components"].remove(component)
192
- return self.update_app_canvas(), f"System: Removed component with ID {component_id}\n"
193
- else:
194
- return "", f"Error: Invalid action: {action}\n"
195
- else:
196
- return "", f"Error: Component with ID {component_id} not found\n"
197
- else:
198
- return "", f"Error: Failed to parse action from NLP response\n"
199
-
200
- def build_app(self):
201
- with gr.Blocks() as demo:
202
- with gr.Tab("App Canvas"):
203
- app_canvas = gr.HTML(self.update_app_canvas())
204
- with gr.Tab("Terminal"):
205
- gr.Markdown("## Terminal")
206
- terminal_input = gr.Textbox(label="Input")
207
- terminal_output = gr.Textbox(label="Output")
208
- run_terminal_command_button = gr.Button("Run Command")
209
- run_terminal_command_button.click(
210
- self.run_terminal_command,
211
- inputs=[terminal_input],
212
- outputs=[terminal_output]
213
- )
214
- with gr.Tab("NLP Models"):
215
- gr.Markdown("## Available NLP Models")
216
- model_index = gr.Slider(label="Model Index", minimum=0, maximum=len(self.nlp_model_names)-1, step=1)
217
- input_text = gr.Textbox(label="Input Text")
218
- get_nlp_response_button = gr.Button("Get NLP Response")
219
- get_nlp_response_button.click(
220
- self.get_nlp_response,
221
- inputs=[input_text, model_index],
222
- outputs="text"
223
- )
224
- # Add components to the app canvas dynamically
225
- for component in self.app_state["components"]:
226
- component_type = component["type"]
227
- properties = component["properties"]
228
-
229
- if component_type == "Button":
230
- gr.Button(value=properties["label"], variant="primary")
231
- elif component_type == "Text Input":
232
- gr.Textbox(label=properties["placeholder"])
233
- elif component_type == "Image":
234
- gr.Image(label=properties["alt"])
235
- elif component_type == "Dropdown":
236
- gr.Dropdown(choices=properties["choices"], label="Dropdown")
237
-
238
- return demo
239
-
240
- def run(self):
241
- self._print_welcome_message()
242
-
243
- while True:
244
- try:
245
- input_text = self._get_user_input()
246
- if input_text.lower() == 'exit':
247
- break
248
- elif input_text.lower() == 'launch':
249
- self.launch_app()
250
- continue
251
-
252
- output, system_message = self.process_input(input_text)
253
- self._display_output(output, system_message)
254
 
255
- except EOFError:
256
- print("Error: Input reading interrupted. Please provide valid input.")
257
- except KeyboardInterrupt:
258
- print("\nApplication stopped by user.")
259
- break
260
- except Exception as e:
261
- print(f"An error occurred: {str(e)}")
262
-
263
- def _print_welcome_message(self):
264
- print("Welcome to the Python App Builder!")
265
- print("Type 'help' to see the available commands.")
266
- print("Type 'launch' to build and launch the Gradio app.")
267
- print("Type 'exit' to quit the application.")
268
- print("-" * 50)
269
-
270
- def _get_user_input(self):
271
- return input("Enter input: ").strip()
272
-
273
- def _display_output(self, output, system_message):
274
- if output:
275
- print(output)
276
- if system_message:
277
- print(system_message)
278
-
279
- def launch_app(self):
280
- print("Launching app...")
281
- demo = self.build_app()
282
- print(f"Demo object type: {type(demo)}")
283
- try:
284
- demo.launch()
285
- print("App launched successfully.")
286
- except Exception as e:
287
- print(f"Error launching app: {str(e)}")
288
-
289
- def main():
290
  try:
291
- app = App()
292
- app.run()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  except Exception as e:
294
- print(f"Error running app: {e}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
 
296
- if __name__ == "__main__":
297
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
  import subprocess
3
  import random
4
+ from huggingface_hub import InferenceClient
 
 
 
 
5
  import gradio as gr
 
6
  from safe_search import safe_search
7
+ from i_search import google
8
+ from i_search import i_search as i_s
9
  from agent import (
10
  ACTION_PROMPT,
11
  ADD_PROMPT,
 
19
  TASK_PROMPT,
20
  UNDERSTAND_TEST_RESULTS_PROMPT,
21
  )
 
22
  from utils import parse_action, parse_file_content, read_python_module_structure
23
+ from datetime import datetime
24
+ now = datetime.now()
25
+ date_time_str = now.strftime("%Y-%m-%d %H:%M:%S")
26
+
27
+ client = InferenceClient(
28
+ "mistralai/Mixtral-8x7B-Instruct-v0.1", cache_dir=None
29
+ )
30
+
31
+
32
+ ############################################
33
+
34
+
35
+ VERBOSE = True
36
+ MAX_HISTORY = 100
37
+ #MODEL = "gpt-3.5-turbo" # "gpt-4"
38
+
39
+
40
+ def format_prompt(message, history):
41
+ prompt = "<s>"
42
+ for user_prompt, bot_response in history:
43
+ prompt += f"[INST] {user_prompt} [/INST]"
44
+ prompt += f" {bot_response}</s> "
45
+ prompt += f"[INST] {message} [/INST]"
46
+ return prompt
47
 
48
+
49
+
50
+ def run_gpt(
51
+ prompt_template,
52
+ stop_tokens,
53
+ max_tokens,
54
+ purpose,
55
+ **prompt_kwargs,
56
+ ):
57
+ seed = random.randint(1,1111111111111111)
58
+ print (seed)
59
+ generate_kwargs = dict(
60
+ temperature=1.0,
61
+ max_new_tokens=2096,
62
+ top_p=0.99,
63
+ repetition_penalty=1.0,
64
+ do_sample=True,
65
+ seed=seed,
66
+ )
67
+
68
+
69
+ content = PREFIX.format(
70
+ date_time_str=date_time_str,
71
+ purpose=purpose,
72
+ safe_search=safe_search,
73
+ ) + prompt_template.format(**prompt_kwargs)
74
+ if VERBOSE:
75
+ print(LOG_PROMPT.format(content))
76
+
77
+
78
+ #formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
79
+ #formatted_prompt = format_prompt(f'{content}', history)
80
+
81
+ stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
82
+ resp = ""
83
+ for response in stream:
84
+ resp += response.token.text
85
+
86
+ if VERBOSE:
87
+ print(LOG_RESPONSE.format(resp))
88
+ return resp
89
+
90
+
91
+ def compress_history(purpose, task, history, directory):
92
+ resp = run_gpt(
93
+ COMPRESS_HISTORY_PROMPT,
94
+ stop_tokens=["observation:", "task:", "action:", "thought:"],
95
+ max_tokens=512,
96
+ purpose=purpose,
97
+ task=task,
98
+ history=history,
99
+ )
100
+ history = "observation: {}\n".format(resp)
101
+ return history
102
+
103
+ def call_search(purpose, task, history, directory, action_input):
104
+ print("CALLING SEARCH")
105
+ try:
106
+
107
+ if "http" in action_input:
108
+ if "<" in action_input:
109
+ action_input = action_input.strip("<")
110
+ if ">" in action_input:
111
+ action_input = action_input.strip(">")
112
+
113
+ response = i_s(action_input)
114
+ #response = google(search_return)
115
+ print(response)
116
+ history += "observation: search result is: {}\n".format(response)
117
  else:
118
+ history += "observation: I need to provide a valid URL to 'action: SEARCH action_input=https://URL'\n"
119
+ except Exception as e:
120
+ history += "observation: {}'\n".format(e)
121
+ return "MAIN", None, history, task
122
+
123
+ def call_main(purpose, task, history, directory, action_input):
124
+ resp = run_gpt(
125
+ ACTION_PROMPT,
126
+ stop_tokens=["observation:", "task:", "action:","thought:"],
127
+ max_tokens=2096,
128
+ purpose=purpose,
129
+ task=task,
130
+ history=history,
131
+ )
132
+ lines = resp.strip().strip("\n").split("\n")
133
+ for line in lines:
134
+ if line == "":
135
+ continue
136
+ if line.startswith("thought: "):
137
+ history += "{}\n".format(line)
138
+ elif line.startswith("action: "):
139
+
140
+ action_name, action_input = parse_action(line)
141
+ print (f'ACTION_NAME :: {action_name}')
142
+ print (f'ACTION_INPUT :: {action_input}')
143
+
144
+ history += "{}\n".format(line)
145
+ if "COMPLETE" in action_name or "COMPLETE" in action_input:
146
+ task = "END"
147
+ return action_name, action_input, history, task
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  else:
149
+ return action_name, action_input, history, task
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  else:
151
+ history += "{}\n".format(line)
152
+ #history += "observation: the following command did not produce any useful output: '{}', I need to check the commands syntax, or use a different command\n".format(line)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
+ #return action_name, action_input, history, task
155
+ #assert False, "unknown action: {}".format(line)
156
+ return "MAIN", None, history, task
157
+
158
+
159
+ def call_set_task(purpose, task, history, directory, action_input):
160
+ task = run_gpt(
161
+ TASK_PROMPT,
162
+ stop_tokens=[],
163
+ max_tokens=64,
164
+ purpose=purpose,
165
+ task=task,
166
+ history=history,
167
+ ).strip("\n")
168
+ history += "observation: task has been updated to: {}\n".format(task)
169
+ return "MAIN", None, history, task
170
+
171
+ def end_fn(purpose, task, history, directory, action_input):
172
+ task = "END"
173
+ return "COMPLETE", "COMPLETE", history, task
174
+
175
+ NAME_TO_FUNC = {
176
+ "MAIN": call_main,
177
+ "UPDATE-TASK": call_set_task,
178
+ "SEARCH": call_search,
179
+ "COMPLETE": end_fn,
180
+
181
+ }
182
+
183
+ def run_action(purpose, task, history, directory, action_name, action_input):
184
+ print(f'action_name::{action_name}')
 
 
 
 
185
  try:
186
+ if "RESPONSE" in action_name or "COMPLETE" in action_name:
187
+ action_name="COMPLETE"
188
+ task="END"
189
+ return action_name, "COMPLETE", history, task
190
+
191
+ # compress the history when it is long
192
+ if len(history.split("\n")) > MAX_HISTORY:
193
+ if VERBOSE:
194
+ print("COMPRESSING HISTORY")
195
+ history = compress_history(purpose, task, history, directory)
196
+ if not action_name in NAME_TO_FUNC:
197
+ action_name="MAIN"
198
+ if action_name == "" or action_name == None:
199
+ action_name="MAIN"
200
+ assert action_name in NAME_TO_FUNC
201
+
202
+ print("RUN: ", action_name, action_input)
203
+ return NAME_TO_FUNC[action_name](purpose, task, history, directory, action_input)
204
  except Exception as e:
205
+ history += "observation: the previous command did not produce any useful output, I need to check the commands syntax, or use a different command\n"
206
+
207
+ return "MAIN", None, history, task
208
+
209
+ def run(purpose,history):
210
+
211
+ #print(purpose)
212
+ #print(hist)
213
+ task=None
214
+ directory="./"
215
+ if history:
216
+ history=str(history).strip("[]")
217
+ if not history:
218
+ history = ""
219
+
220
+ action_name = "UPDATE-TASK" if task is None else "MAIN"
221
+ action_input = None
222
+ while True:
223
+ print("")
224
+ print("")
225
+ print("---")
226
+ print("purpose:", purpose)
227
+ print("task:", task)
228
+ print("---")
229
+ print(history)
230
+ print("---")
231
+
232
+ action_name, action_input, history, task = run_action(
233
+ purpose,
234
+ task,
235
+ history,
236
+ directory,
237
+ action_name,
238
+ action_input,
239
+ )
240
+ yield (history)
241
+ #yield ("",[(purpose,history)])
242
+ if task == "END":
243
+ return (history)
244
+ #return ("", [(purpose,history)])
245
+
246
+
247
+
248
+ ################################################
249
+
250
+ def format_prompt(message, history):
251
+ prompt = "<s>"
252
+ for user_prompt, bot_response in history:
253
+ prompt += f"[INST] {user_prompt} [/INST]"
254
+ prompt += f" {bot_response}</s> "
255
+ prompt += f"[INST] {message} [/INST]"
256
+ return prompt
257
+ agents =[
258
+ "WEB_DEV",
259
+ "AI_SYSTEM_PROMPT",
260
+ "PYTHON_CODE_DEV"
261
+ ]
262
+ def generate(
263
+ prompt, history, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
264
+ ):
265
+ seed = random.randint(1,1111111111111111)
266
+
267
+ agent=prompts.WEB_DEV
268
+ if agent_name == "WEB_DEV":
269
+ agent = prompts.WEB_DEV
270
+ if agent_name == "AI_SYSTEM_PROMPT":
271
+ agent = prompts.AI_SYSTEM_PROMPT
272
+ if agent_name == "PYTHON_CODE_DEV":
273
+ agent = prompts.PYTHON_CODE_DEV
274
+ system_prompt=agent
275
+ temperature = float(temperature)
276
+ if temperature < 1e-2:
277
+ temperature = 1e-2
278
+ top_p = float(top_p)
279
+
280
+ generate_kwargs = dict(
281
+ temperature=temperature,
282
+ max_new_tokens=max_new_tokens,
283
+ top_p=top_p,
284
+ repetition_penalty=repetition_penalty,
285
+ do_sample=True,
286
+ seed=seed,
287
+ )
288
+
289
+ formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
290
+ stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
291
+ output = ""
292
+
293
+ for response in stream:
294
+ output += response.token.text
295
+ yield output
296
+ return output
297
+
298
+
299
+ additional_inputs=[
300
+ gr.Dropdown(
301
+ label="Agents",
302
+ choices=[s for s in agents],
303
+ value=agents[0],
304
+ interactive=True,
305
+ ),
306
+ gr.Textbox(
307
+ label="System Prompt",
308
+ max_lines=1,
309
+ interactive=True,
310
+ ),
311
+ gr.Slider(
312
+ label="Temperature",
313
+ value=0.9,
314
+ minimum=0.0,
315
+ maximum=1.0,
316
+ step=0.05,
317
+ interactive=True,
318
+ info="Higher values produce more diverse outputs",
319
+ ),
320
+
321
+ gr.Slider(
322
+ label="Max new tokens",
323
+ value=1048*10,
324
+ minimum=0,
325
+ maximum=1048*10,
326
+ step=64,
327
+ interactive=True,
328
+ info="The maximum numbers of new tokens",
329
+ ),
330
+ gr.Slider(
331
+ label="Top-p (nucleus sampling)",
332
+ value=0.90,
333
+ minimum=0.0,
334
+ maximum=1,
335
+ step=0.05,
336
+ interactive=True,
337
+ info="Higher values sample more low-probability tokens",
338
+ ),
339
+ gr.Slider(
340
+ label="Repetition penalty",
341
+ value=1.2,
342
+ minimum=1.0,
343
+ maximum=2.0,
344
+ step=0.05,
345
+ interactive=True,
346
+ info="Penalize repeated tokens",
347
+ ),
348
+
349
+
350
+ ]
351
+
352
+ examples=[["What are the biggest news stories today?", None, None, None, None, None, ],
353
+ ["When is the next full moon?", None, None, None, None, None, ],
354
+ ["I'm planning a vacation to Japan. Can you suggest a one-week itinerary including must-visit places and local cuisines to try?", None, None, None, None, None, ],
355
+ ["Can you write a short story about a time-traveling detective who solves historical mysteries?", None, None, None, None, None,],
356
+ ["I'm trying to learn French. Can you provide some common phrases that would be useful for a beginner, along with their pronunciations?", None, None, None, None, None,],
357
+ ["I have chicken, rice, and bell peppers in my kitchen. Can you suggest an easy recipe I can make with these ingredients?", None, None, None, None, None,],
358
+ ["Can you explain how the QuickSort algorithm works and provide a Python implementation?", None, None, None, None, None,],
359
+ ["What are some unique features of Rust that make it stand out compared to other systems programming languages like C++?", None, None, None, None, None,],
360
+ ]
361
 
362
+ '''
363
+ gr.ChatInterface(
364
+ fn=run,
365
+ chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
366
+ title="Mixtral 46.7B\nMicro-Agent\nInternet Search <br> development test",
367
+ examples=examples,
368
+ concurrency_limit=20,
369
+ with gr.Blocks() as ifacea:
370
+ gr.HTML("""TEST""")
371
+ ifacea.launch()
372
+ ).launch()
373
+ with gr.Blocks() as iface:
374
+ #chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
375
+ chatbot=gr.Chatbot()
376
+ msg = gr.Textbox()
377
+ with gr.Row():
378
+ submit_b = gr.Button()
379
+ clear = gr.ClearButton([msg, chatbot])
380
+ submit_b.click(run, [msg,chatbot],[msg,chatbot])
381
+ msg.submit(run, [msg, chatbot], [msg, chatbot])
382
+ iface.launch()
383
+ '''
384
+ gr.ChatInterface(
385
+ fn=run,
386
+ chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, super-intelligence=True, layout="panel"),
387
+ title="Mixtral 46.7B\nMicro-Agent\nInternet Search <br> development test",
388
+ examples=examples,
389
+ concurrency_limit=50,
390
+ ).launch(show_api=True)