Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -223,29 +223,12 @@ def run_chat(message, history):
|
|
| 223 |
command = message[1:]
|
| 224 |
terminal_history = run_terminal_command(command, history)
|
| 225 |
else:
|
| 226 |
-
# ... (Your regular chat response generation)
|
| 227 |
-
model_index = 0 # Select the model to use for chat response
|
| 228 |
-
response = get_nlp_response(message, model_index)
|
| 229 |
-
if response:
|
| 230 |
-
return history, terminal_history + f"User: {message}\nAssistant: {response}"
|
| 231 |
-
else:
|
| 232 |
-
return history, terminal_history + f"User: {message}\nAssistant: I'm sorry, I couldn't generate a response. Please try again.\n"
|
| 233 |
-
|
| 234 |
-
--- Function to handle chat interaction ---
|
| 235 |
-
def run_chat(message, history):
|
| 236 |
-
global terminal_history
|
| 237 |
-
if message.startswith("!"):
|
| 238 |
-
command = message[1:]
|
| 239 |
-
terminal_history = run_terminal_command(command, history)
|
| 240 |
-
else:
|
| 241 |
-
# ... (Your regular chat response generation)
|
| 242 |
model_index = 0 # Select the model to use for chat response
|
| 243 |
response = get_nlp_response(message, model_index)
|
| 244 |
if response:
|
| 245 |
-
return history, terminal_history + f"
|
| 246 |
else:
|
| 247 |
-
return history, terminal_history + f"
|
| 248 |
-
|
| 249 |
--- Code Generation ---
|
| 250 |
def generate_python_code(app_name):
|
| 251 |
code = f"""import gradio as gr
|
|
|
|
| 223 |
command = message[1:]
|
| 224 |
terminal_history = run_terminal_command(command, history)
|
| 225 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
model_index = 0 # Select the model to use for chat response
|
| 227 |
response = get_nlp_response(message, model_index)
|
| 228 |
if response:
|
| 229 |
+
return history, terminal_history + f"User: {message}\nAssistant: {response}"
|
| 230 |
else:
|
| 231 |
+
return history, terminal_history + f"User: {message}\nAssistant: I'm sorry, I couldn't generate a response. Please try again.\n"
|
|
|
|
| 232 |
--- Code Generation ---
|
| 233 |
def generate_python_code(app_name):
|
| 234 |
code = f"""import gradio as gr
|