acecalisto3 commited on
Commit
61d8a8c
β€’
1 Parent(s): 272fc39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -21
app.py CHANGED
@@ -57,7 +57,7 @@ I am confident that I can leverage my expertise to assist you in developing and
57
  next_step = "Based on the current state, the next logical step is to implement the main application logic."
58
  return summary, next_step
59
 
60
- def deploy_built_space_to_hf(self):
61
  # Assuming you have a function that generates the space content
62
  space_content = generate_space_content(project_name)
63
  repository = self._hf_api.create_repo(
@@ -119,7 +119,7 @@ def display_workspace_projects(workspace_projects):
119
 
120
  def generate_space_content(project_name):
121
  # Logic to generate the Streamlit app content based on project_name
122
- # ... (This is where you'll need to implement the actual code generation)
123
  return "import streamlit as st\nst.title('My Streamlit App')\nst.write('Hello, world!')"
124
 
125
  def get_code_generation_model(language):
@@ -156,7 +156,7 @@ if __name__ == "__main__":
156
  output = run_code(terminal_input)
157
  st.session_state.terminal_history.append((terminal_input, output))
158
  st.code(output, language="bash")
159
- if ai_guide_level != "No Assistance":
160
  st.write("Run commands here to add packages to your project. For example: `pip install <package-name>`.")
161
  if terminal_input and "install" in terminal_input:
162
  package_name = terminal_input.split("install")[-1].strip()
@@ -181,7 +181,7 @@ if __name__ == "__main__":
181
  if st.button(f"Move {file} to app folder"):
182
  # Logic to move file to 'app' folder
183
  pass
184
- if ai_guide_level != "No Assistance":
185
  st.write("You can upload files and move them into the 'app' folder for building your application.")
186
 
187
  elif app_mode == "Code Editor":
@@ -190,7 +190,7 @@ if __name__ == "__main__":
190
  if st.button("Save Code"):
191
  # Logic to save code
192
  pass
193
- if ai_guide_level != "No Assistance":
194
  st.write("The function `foo()` requires the `bar` package. Add it to `requirements.txt`.")
195
 
196
  elif app_mode == "Build & Deploy":
@@ -208,12 +208,12 @@ if __name__ == "__main__":
208
  st.write("Next Step:")
209
  st.write(next_step)
210
  if agent._hf_api and agent.has_valid_hf_token():
211
- repository = agent.deploy_built_space_to_hf()
212
  st.markdown("## Congratulations! Successfully deployed Space πŸš€ ##")
213
  st.markdown("[Check out your new Space here](hf.co/" + repository.name + ")")
214
 
215
  # Code Generation
216
- if ai_guide_level != "No Assistance":
217
  code_input = st.text_area("Enter code to generate:", height=300)
218
  if st.button("Generate Code"):
219
  language = st.session_state.selected_language
@@ -236,14 +236,14 @@ if __name__ == "__main__":
236
  color: #333;
237
  }
238
 
239
- .container {
240
  width: 90%;
241
  margin: 0 auto;
242
  padding: 20px;
243
  }
244
 
245
  /* Navigation Sidebar */
246
- .sidebar {
247
  background-color: #2c3e50;
248
  color: #ecf0f1;
249
  padding: 20px;
@@ -255,20 +255,20 @@ if __name__ == "__main__":
255
  overflow-y: auto;
256
  }
257
 
258
- .sidebar a {
259
  color: #ecf0f1;
260
  text-decoration: none;
261
  display: block;
262
  padding: 10px 0;
263
  }
264
 
265
- .sidebar a:hover {
266
  background-color: #34495e;
267
  border-radius: 5px;
268
  }
269
 
270
  /* Main Content */
271
- .main-content {
272
  margin-left: 270px;
273
  padding: 20px;
274
  }
@@ -304,7 +304,7 @@ if __name__ == "__main__":
304
  }
305
 
306
  /* Terminal Output */
307
- .code-output {
308
  background-color: #1e1e1e;
309
  color: #dcdcdc;
310
  padding: 20px;
@@ -313,7 +313,7 @@ if __name__ == "__main__":
313
  }
314
 
315
  /* Chat History */
316
- .chat-history {
317
  background-color: #ecf0f1;
318
  padding: 20px;
319
  border-radius: 5px;
@@ -321,22 +321,22 @@ if __name__ == "__main__":
321
  overflow-y: auto;
322
  }
323
 
324
- .chat-message {
325
  margin-bottom: 10px;
326
  }
327
 
328
- .chat-message.user {
329
  text-align: right;
330
  color: #3498db;
331
  }
332
 
333
- .chat-message.agent {
334
  text-align: left;
335
  color: #e74c3c;
336
  }
337
 
338
  /* Project Management */
339
- .project-list {
340
  background-color: #ecf0f1;
341
  padding: 20px;
342
  border-radius: 5px;
@@ -344,16 +344,16 @@ if __name__ == "__main__":
344
  overflow-y: auto;
345
  }
346
 
347
- .project-item {
348
  margin-bottom: 10px;
349
  }
350
 
351
- .project-item a {
352
  color: #3498db;
353
  text-decoration: none;
354
  }
355
 
356
- .project-item a:hover {
357
  text-decoration: underline;
358
  }
359
  </style>
 
57
  next_step = "Based on the current state, the next logical step is to implement the main application logic."
58
  return summary, next_step
59
 
60
+ def deploy_built_space_to_hf(self, project_name):
61
  # Assuming you have a function that generates the space content
62
  space_content = generate_space_content(project_name)
63
  repository = self._hf_api.create_repo(
 
119
 
120
  def generate_space_content(project_name):
121
  # Logic to generate the Streamlit app content based on project_name
122
+ #... (This is where you'll need to implement the actual code generation)
123
  return "import streamlit as st\nst.title('My Streamlit App')\nst.write('Hello, world!')"
124
 
125
  def get_code_generation_model(language):
 
156
  output = run_code(terminal_input)
157
  st.session_state.terminal_history.append((terminal_input, output))
158
  st.code(output, language="bash")
159
+ if ai_guide_level!= "No Assistance":
160
  st.write("Run commands here to add packages to your project. For example: `pip install <package-name>`.")
161
  if terminal_input and "install" in terminal_input:
162
  package_name = terminal_input.split("install")[-1].strip()
 
181
  if st.button(f"Move {file} to app folder"):
182
  # Logic to move file to 'app' folder
183
  pass
184
+ if ai_guide_level!= "No Assistance":
185
  st.write("You can upload files and move them into the 'app' folder for building your application.")
186
 
187
  elif app_mode == "Code Editor":
 
190
  if st.button("Save Code"):
191
  # Logic to save code
192
  pass
193
+ if ai_guide_level!= "No Assistance":
194
  st.write("The function `foo()` requires the `bar` package. Add it to `requirements.txt`.")
195
 
196
  elif app_mode == "Build & Deploy":
 
208
  st.write("Next Step:")
209
  st.write(next_step)
210
  if agent._hf_api and agent.has_valid_hf_token():
211
+ repository = agent.deploy_built_space_to_hf(project_name_input)
212
  st.markdown("## Congratulations! Successfully deployed Space πŸš€ ##")
213
  st.markdown("[Check out your new Space here](hf.co/" + repository.name + ")")
214
 
215
  # Code Generation
216
+ if ai_guide_level!= "No Assistance":
217
  code_input = st.text_area("Enter code to generate:", height=300)
218
  if st.button("Generate Code"):
219
  language = st.session_state.selected_language
 
236
  color: #333;
237
  }
238
 
239
+ .container {
240
  width: 90%;
241
  margin: 0 auto;
242
  padding: 20px;
243
  }
244
 
245
  /* Navigation Sidebar */
246
+ .sidebar {
247
  background-color: #2c3e50;
248
  color: #ecf0f1;
249
  padding: 20px;
 
255
  overflow-y: auto;
256
  }
257
 
258
+ .sidebar a {
259
  color: #ecf0f1;
260
  text-decoration: none;
261
  display: block;
262
  padding: 10px 0;
263
  }
264
 
265
+ .sidebar a:hover {
266
  background-color: #34495e;
267
  border-radius: 5px;
268
  }
269
 
270
  /* Main Content */
271
+ .main-content {
272
  margin-left: 270px;
273
  padding: 20px;
274
  }
 
304
  }
305
 
306
  /* Terminal Output */
307
+ .code-output {
308
  background-color: #1e1e1e;
309
  color: #dcdcdc;
310
  padding: 20px;
 
313
  }
314
 
315
  /* Chat History */
316
+ .chat-history {
317
  background-color: #ecf0f1;
318
  padding: 20px;
319
  border-radius: 5px;
 
321
  overflow-y: auto;
322
  }
323
 
324
+ .chat-message {
325
  margin-bottom: 10px;
326
  }
327
 
328
+ .chat-message.user {
329
  text-align: right;
330
  color: #3498db;
331
  }
332
 
333
+ .chat-message.agent {
334
  text-align: left;
335
  color: #e74c3c;
336
  }
337
 
338
  /* Project Management */
339
+ .project-list {
340
  background-color: #ecf0f1;
341
  padding: 20px;
342
  border-radius: 5px;
 
344
  overflow-y: auto;
345
  }
346
 
347
+ .project-item {
348
  margin-bottom: 10px;
349
  }
350
 
351
+ .project-item a {
352
  color: #3498db;
353
  text-decoration: none;
354
  }
355
 
356
+ .project-item a:hover {
357
  text-decoration: underline;
358
  }
359
  </style>