Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,77 @@ def main_ui():
|
|
46 |
keylock_decode_button.click(load_token_from_image_and_set_env, [keylock_image_input, keylock_password_input], [keylock_status_output])
|
47 |
else:
|
48 |
gr.Markdown("_(KeyLock Wallet image decoding disabled: library not found.)_")
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
# --- Main Application Tabs ---
|
51 |
with gr.Tabs():
|
52 |
with gr.TabItem("π Create New Space"):
|
|
|
46 |
keylock_decode_button.click(load_token_from_image_and_set_env, [keylock_image_input, keylock_password_input], [keylock_status_output])
|
47 |
else:
|
48 |
gr.Markdown("_(KeyLock Wallet image decoding disabled: library not found.)_")
|
49 |
+
with gr.Accordion("π£ Example Prompt", open=False):
|
50 |
+
gr.Markdown("""# Prompt:
|
51 |
+
|
52 |
+
Generate program files for a project as a single plain text string, strictly adhering to the markdown format below. **Every single line**, including backticks, language identifiers, file content, and empty lines, **must** be prefixed with '# ' to comment it out. This is critical to avoid code box interference. The output must include a complete file structure and the contents of each file, with all necessary code and configurations for a functional project. **Do not deviate from this format under any circumstances.**
|
53 |
+
|
54 |
+
# Format (exact return format with single leading "# "):
|
55 |
+
markdown```
|
56 |
+
# # Space: [owner/project-name]
|
57 |
+
# ## File Structure
|
58 |
+
# ```
|
59 |
+
# π Root
|
60 |
+
# π [file1]
|
61 |
+
# π [file2]
|
62 |
+
# ...
|
63 |
+
#
|
64 |
+
#
|
65 |
+
# Below are the contents of all files in the space:
|
66 |
+
#
|
67 |
+
# ### File: [file1]
|
68 |
+
# ```[language]
|
69 |
+
# [content]
|
70 |
+
# ```
|
71 |
+
#
|
72 |
+
# ### File: [file2]
|
73 |
+
# ```[language]
|
74 |
+
# [content]
|
75 |
+
# ```
|
76 |
+
#
|
77 |
+
# ... (repeat for each file)
|
78 |
+
```
|
79 |
+
# Correct Example Output (exact, every line prefixed with '# '):
|
80 |
+
```markdown
|
81 |
+
# # Space: user/my-app
|
82 |
+
# ## File Structure
|
83 |
+
# ```
|
84 |
+
# π Root
|
85 |
+
# π app.py
|
86 |
+
# π requirements.txt
|
87 |
+
# ```
|
88 |
+
#
|
89 |
+
# # Below are the contents of all files in the space:
|
90 |
+
#
|
91 |
+
# ### File: app.py
|
92 |
+
# ```python
|
93 |
+
# print("Hello, World!")
|
94 |
+
# ```
|
95 |
+
#
|
96 |
+
# ### File: requirements.txt
|
97 |
+
# ```text
|
98 |
+
# gradio==4.44.0
|
99 |
+
# ```
|
100 |
+
```
|
101 |
+
# Incorrect Example Output:
|
102 |
+
```markdown
|
103 |
+
## ## File Structure <- INCORRECT: AI used "## " instead of "# "
|
104 |
+
## ```text <- INCORRECT
|
105 |
+
## π Root <- INCORRECT (missing "# ")
|
106 |
+
# # # π Root <- INCORRECT: AI used "# # #" instead of "# "
|
107 |
+
```
|
108 |
+
|
109 |
+
# Instructions:
|
110 |
+
- Use exactly `# # Space: [owner/project-name]` as the header (e.g., `user/my-app`).
|
111 |
+
- Under `## File Structure`, start with `# π Root` followed by `# π` for each file, using exact icons and spacing.
|
112 |
+
- For each file, use `# ### File: [filename]` followed by a code block where every line, including backticks (e.g., `# ```), language identifier (e.g., `# python`), and content (e.g., `# print("Hello")`), is prefixed with `# `.
|
113 |
+
- For binary files, use `# [Binary file - size in bytes]` as content with no language identifier.
|
114 |
+
- **Every line** must start with `# `, no exceptions, including empty lines within code blocks.
|
115 |
+
- Provide accurate, functional code or content for each file, suitable for the projectβs purpose.
|
116 |
+
- Ensure the output is concise, complete, and parseable to extract file structure and contents.
|
117 |
+
- Output everything as a single plain text string within one code box.
|
118 |
+
""")
|
119 |
+
|
120 |
# --- Main Application Tabs ---
|
121 |
with gr.Tabs():
|
122 |
with gr.TabItem("π Create New Space"):
|