Spaces:
Sleeping
Sleeping
Commit
·
e063ea2
1
Parent(s):
5193b03
Demo version
Browse files
app.py
CHANGED
|
@@ -74,29 +74,7 @@ Generate the code:"""
|
|
| 74 |
|
| 75 |
# Gradio interface
|
| 76 |
def create_interface():
|
| 77 |
-
with gr.Blocks(
|
| 78 |
-
title="Flutter Code Generator",
|
| 79 |
-
theme=gr.themes.Soft(),
|
| 80 |
-
css="""
|
| 81 |
-
.gradio-container {
|
| 82 |
-
max-width: 1200px;
|
| 83 |
-
margin: auto;
|
| 84 |
-
}
|
| 85 |
-
.title {
|
| 86 |
-
text-align: center;
|
| 87 |
-
color: #2563eb;
|
| 88 |
-
font-size: 2.5em;
|
| 89 |
-
font-weight: bold;
|
| 90 |
-
margin-bottom: 1em;
|
| 91 |
-
}
|
| 92 |
-
.subtitle {
|
| 93 |
-
text-align: center;
|
| 94 |
-
color: #64748b;
|
| 95 |
-
font-size: 1.2em;
|
| 96 |
-
margin-bottom: 2em;
|
| 97 |
-
}
|
| 98 |
-
"""
|
| 99 |
-
) as interface:
|
| 100 |
gr.HTML("""
|
| 101 |
<div class="title">🚀 Flutter Code Generator</div>
|
| 102 |
<div class="subtitle">Transform your ideas into Flutter/Dart code using AI</div>
|
|
@@ -107,15 +85,13 @@ def create_interface():
|
|
| 107 |
prompt_input = gr.Textbox(
|
| 108 |
label="Describe your Flutter component or feature",
|
| 109 |
placeholder="e.g., Create a login form with email and password fields, validation, and submit button...",
|
| 110 |
-
lines=6
|
| 111 |
-
show_copy_button=True
|
| 112 |
)
|
| 113 |
|
| 114 |
api_token_input = gr.Textbox(
|
| 115 |
label="Hugging Face API Token (optional)",
|
| 116 |
placeholder="Enter your HF token or set HF_TOKEN env variable",
|
| 117 |
-
type="password"
|
| 118 |
-
show_copy_button=True
|
| 119 |
)
|
| 120 |
|
| 121 |
generate_btn = gr.Button(
|
|
@@ -128,8 +104,7 @@ def create_interface():
|
|
| 128 |
output_code = gr.Code(
|
| 129 |
label="Generated Flutter/Dart Code",
|
| 130 |
language="dart",
|
| 131 |
-
lines=20
|
| 132 |
-
show_copy_button=True
|
| 133 |
)
|
| 134 |
|
| 135 |
with gr.Accordion("How to use", open=False):
|
|
@@ -183,5 +158,25 @@ if __name__ == "__main__":
|
|
| 183 |
server_name="0.0.0.0",
|
| 184 |
server_port=int(os.getenv("PORT", 7860)),
|
| 185 |
show_error=True,
|
| 186 |
-
share=False # Set to True for public sharing on HF Spaces
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
)
|
|
|
|
| 74 |
|
| 75 |
# Gradio interface
|
| 76 |
def create_interface():
|
| 77 |
+
with gr.Blocks(title="Flutter Code Generator") as interface:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
gr.HTML("""
|
| 79 |
<div class="title">🚀 Flutter Code Generator</div>
|
| 80 |
<div class="subtitle">Transform your ideas into Flutter/Dart code using AI</div>
|
|
|
|
| 85 |
prompt_input = gr.Textbox(
|
| 86 |
label="Describe your Flutter component or feature",
|
| 87 |
placeholder="e.g., Create a login form with email and password fields, validation, and submit button...",
|
| 88 |
+
lines=6
|
|
|
|
| 89 |
)
|
| 90 |
|
| 91 |
api_token_input = gr.Textbox(
|
| 92 |
label="Hugging Face API Token (optional)",
|
| 93 |
placeholder="Enter your HF token or set HF_TOKEN env variable",
|
| 94 |
+
type="password"
|
|
|
|
| 95 |
)
|
| 96 |
|
| 97 |
generate_btn = gr.Button(
|
|
|
|
| 104 |
output_code = gr.Code(
|
| 105 |
label="Generated Flutter/Dart Code",
|
| 106 |
language="dart",
|
| 107 |
+
lines=20
|
|
|
|
| 108 |
)
|
| 109 |
|
| 110 |
with gr.Accordion("How to use", open=False):
|
|
|
|
| 158 |
server_name="0.0.0.0",
|
| 159 |
server_port=int(os.getenv("PORT", 7860)),
|
| 160 |
show_error=True,
|
| 161 |
+
share=False, # Set to True for public sharing on HF Spaces
|
| 162 |
+
theme=gr.themes.Soft(),
|
| 163 |
+
css="""
|
| 164 |
+
.gradio-container {
|
| 165 |
+
max-width: 1200px;
|
| 166 |
+
margin: auto;
|
| 167 |
+
}
|
| 168 |
+
.title {
|
| 169 |
+
text-align: center;
|
| 170 |
+
color: #2563eb;
|
| 171 |
+
font-size: 2.5em;
|
| 172 |
+
font-weight: bold;
|
| 173 |
+
margin-bottom: 1em;
|
| 174 |
+
}
|
| 175 |
+
.subtitle {
|
| 176 |
+
text-align: center;
|
| 177 |
+
color: #64748b;
|
| 178 |
+
font-size: 1.2em;
|
| 179 |
+
margin-bottom: 2em;
|
| 180 |
+
}
|
| 181 |
+
"""
|
| 182 |
)
|