Cristobal299 commited on
Commit
7f42b00
·
verified ·
1 Parent(s): 4cc132c

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -107,7 +107,7 @@ def _create_zip(file_dict: dict) -> str:
107
  # ----------------------------------------------------------------------
108
  def generate_web_code(idea: str, language: str):
109
  """
110
- Generates a complete web project (HTML/CSS/JS or a singlefile script)
111
  based on the user's idea and the selected language.
112
  Returns a tuple: (preview_text, zip_file_path)
113
  """
@@ -118,7 +118,7 @@ def generate_web_code(idea: str, language: str):
118
  return ("No Groq API key configured. Set the GROQ_API_KEY environment variable.", None)
119
 
120
  prompt = (
121
- f"You are a senior fullstack developer. Based on the following description, "
122
  f"write a complete, runnable {language} web application. Include all necessary "
123
  "files (HTML, CSS, JavaScript, or a single script) and comment the code. "
124
  "Also provide a minimal requirements.txt, a README.md explaining how to run the project, "
@@ -226,16 +226,15 @@ with gr.Blocks() as demo:
226
  placeholder="The generated code will appear here",
227
  lines=12,
228
  )
229
- download_btn = gr.File(
230
  label="Download Project Zip",
231
  type="filepath",
232
- visible=False,
233
  )
234
  generate_btn = gr.Button("Generate")
235
  generate_btn.click(
236
  fn=generate_web_code,
237
  inputs=[idea_input, lang_select_generate],
238
- outputs=[generated_preview, download_btn],
239
  )
240
 
241
  demo.launch()
 
107
  # ----------------------------------------------------------------------
108
  def generate_web_code(idea: str, language: str):
109
  """
110
+ Generates a complete web project (HTML/CSS/JS or a single-file script)
111
  based on the user's idea and the selected language.
112
  Returns a tuple: (preview_text, zip_file_path)
113
  """
 
118
  return ("No Groq API key configured. Set the GROQ_API_KEY environment variable.", None)
119
 
120
  prompt = (
121
+ f"You are a senior full-stack developer. Based on the following description, "
122
  f"write a complete, runnable {language} web application. Include all necessary "
123
  "files (HTML, CSS, JavaScript, or a single script) and comment the code. "
124
  "Also provide a minimal requirements.txt, a README.md explaining how to run the project, "
 
226
  placeholder="The generated code will appear here",
227
  lines=12,
228
  )
229
+ download_file = gr.File(
230
  label="Download Project Zip",
231
  type="filepath",
 
232
  )
233
  generate_btn = gr.Button("Generate")
234
  generate_btn.click(
235
  fn=generate_web_code,
236
  inputs=[idea_input, lang_select_generate],
237
+ outputs=[generated_preview, download_file],
238
  )
239
 
240
  demo.launch()