Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -154,11 +154,6 @@ def terminal_interface(command, project_name=None):
|
|
| 154 |
st.session_state.current_state['toolbox']['terminal_output'] = result.stderr
|
| 155 |
return result.stderr
|
| 156 |
|
| 157 |
-
# Chat interface using a selected agent
|
| 158 |
-
def chat_interface_with_agent(input_text, agent_name):
|
| 159 |
-
# ... [rest of the chat_interface_with_agent function] ...
|
| 160 |
-
|
| 161 |
-
|
| 162 |
def summarize_text(text):
|
| 163 |
summarizer = pipeline("summarization")
|
| 164 |
summary = summarizer(text, max_length=50, min_length=25, do_sample=False)
|
|
@@ -176,9 +171,14 @@ def sentiment_analysis(text):
|
|
| 176 |
def generate_code(code_idea):
|
| 177 |
# Replace this with a call to a Hugging Face model or your own logic
|
| 178 |
# For example, using a text-generation pipeline:
|
| 179 |
-
generator = pipeline('text-generation', model='
|
| 180 |
-
generated_code = generator(code_idea, max_length=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
st.session_state.current_state['toolbox']['generated_code'] = generated_code
|
|
|
|
| 182 |
return generated_code
|
| 183 |
|
| 184 |
def translate_code(code, input_language, output_language):
|
|
|
|
| 154 |
st.session_state.current_state['toolbox']['terminal_output'] = result.stderr
|
| 155 |
return result.stderr
|
| 156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
def summarize_text(text):
|
| 158 |
summarizer = pipeline("summarization")
|
| 159 |
summary = summarizer(text, max_length=50, min_length=25, do_sample=False)
|
|
|
|
| 171 |
def generate_code(code_idea):
|
| 172 |
# Replace this with a call to a Hugging Face model or your own logic
|
| 173 |
# For example, using a text-generation pipeline:
|
| 174 |
+
generator = pipeline('text-generation', model='gpt4o')
|
| 175 |
+
generated_code = generator(code_idea, max_length=10000, num_return_sequences=1)[0]['generated_text']
|
| 176 |
+
messages=[
|
| 177 |
+
{"role": "system", "content": "You are an expert software developer."},
|
| 178 |
+
{"role": "user", "content": f"Generate a Python code snippet for the following idea:\n\n{code_idea}"}
|
| 179 |
+
]
|
| 180 |
st.session_state.current_state['toolbox']['generated_code'] = generated_code
|
| 181 |
+
|
| 182 |
return generated_code
|
| 183 |
|
| 184 |
def translate_code(code, input_language, output_language):
|