Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -229,19 +229,15 @@ def run_chat(message, history):
|
|
| 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 |
-
|
| 233 |
def generate_python_code(app_name):
|
| 234 |
code = f"""import gradio as gr
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
for component in app_state["components"]:
|
| 238 |
-
code += " " + Component(**component).render() + "\n"
|
| 239 |
|
| 240 |
code += f"""
|
| 241 |
-
|
| 242 |
-
return code
|
| 243 |
|
| 244 |
-
--- Hugging Face Deployment ---
|
| 245 |
def deploy_to_huggingface(app_name):
|
| 246 |
|
| 247 |
# Generate Python code
|
|
|
|
| 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 |
+
|
| 233 |
def generate_python_code(app_name):
|
| 234 |
code = f"""import gradio as gr
|
| 235 |
+
Define your Gradio components here
|
| 236 |
+
with gr.Blocks() as {app_name}: """ for component in app_state["components"]: code += " " + Component(**component).render() + "\n"
|
|
|
|
|
|
|
| 237 |
|
| 238 |
code += f"""
|
| 239 |
+
{app_name}.launch() """ return code
|
|
|
|
| 240 |
|
|
|
|
| 241 |
def deploy_to_huggingface(app_name):
|
| 242 |
|
| 243 |
# Generate Python code
|