Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- app.py +9 -7
- coder/__pycache__/crew.cpython-311.pyc +0 -0
- coder/config/agents.yaml +2 -2
- coder/config/tasks.yaml +1 -1
- coder/crew.py +1 -1
app.py
CHANGED
|
@@ -1,12 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
from coder.crew import Coder
|
|
|
|
| 4 |
|
| 5 |
load_dotenv(override=True)
|
| 6 |
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
def run(assignment):
|
| 11 |
|
| 12 |
|
|
@@ -14,21 +13,23 @@ def run(assignment):
|
|
| 14 |
'assignment': assignment,
|
| 15 |
}
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
result= Coder().crew().kickoff(inputs=inputs)
|
| 18 |
output = result.raw
|
| 19 |
return output
|
| 20 |
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
# Build the UI
|
| 25 |
with gr.Blocks(theme="soft") as ui:
|
| 26 |
gr.Markdown(
|
| 27 |
"""
|
| 28 |
# 👨💻 Python Coder by Efay Guo
|
| 29 |
-
This is a code
|
| 30 |
|
| 31 |
-
这是一个用于写Pyton代码的Agent
|
| 32 |
|
| 33 |
"""
|
| 34 |
)
|
|
@@ -38,7 +39,8 @@ with gr.Blocks(theme="soft") as ui:
|
|
| 38 |
run_button = gr.Button("Start Writing Code / 开始写代码", variant="huggingface")
|
| 39 |
report = gr.Markdown(label="Report")
|
| 40 |
|
| 41 |
-
run_button.click(fn=run, inputs=query_textbox, outputs=report,show_progress="full")
|
|
|
|
| 42 |
query_textbox.submit(fn=run, inputs=query_textbox, outputs=report, show_progress="full")
|
| 43 |
|
| 44 |
ui.launch(inbrowser=True)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
from coder.crew import Coder
|
| 4 |
+
import time
|
| 5 |
|
| 6 |
load_dotenv(override=True)
|
| 7 |
|
| 8 |
|
|
|
|
|
|
|
| 9 |
def run(assignment):
|
| 10 |
|
| 11 |
|
|
|
|
| 13 |
'assignment': assignment,
|
| 14 |
}
|
| 15 |
|
| 16 |
+
|
| 17 |
+
gr.Info(f"Start processing: {assignment}... you many need to wait up to 30 seconds ||| 开始任务: {assignment}... 你可能要等待30秒", duration=30)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
result= Coder().crew().kickoff(inputs=inputs)
|
| 21 |
output = result.raw
|
| 22 |
return output
|
| 23 |
|
| 24 |
|
|
|
|
|
|
|
| 25 |
# Build the UI
|
| 26 |
with gr.Blocks(theme="soft") as ui:
|
| 27 |
gr.Markdown(
|
| 28 |
"""
|
| 29 |
# 👨💻 Python Coder by Efay Guo
|
| 30 |
+
This is a Python code writer that generates Python code you need and explain it line by line and show you the final result.
|
| 31 |
|
| 32 |
+
这是一个用于写Pyton代码的Agent,不仅可以帮你写代码,也会给你每行进行解释,展示程序最后的结果。
|
| 33 |
|
| 34 |
"""
|
| 35 |
)
|
|
|
|
| 39 |
run_button = gr.Button("Start Writing Code / 开始写代码", variant="huggingface")
|
| 40 |
report = gr.Markdown(label="Report")
|
| 41 |
|
| 42 |
+
run_button.click(fn=run, inputs=query_textbox, outputs=report, show_progress="full")
|
| 43 |
+
|
| 44 |
query_textbox.submit(fn=run, inputs=query_textbox, outputs=report, show_progress="full")
|
| 45 |
|
| 46 |
ui.launch(inbrowser=True)
|
coder/__pycache__/crew.cpython-311.pyc
CHANGED
|
Binary files a/coder/__pycache__/crew.cpython-311.pyc and b/coder/__pycache__/crew.cpython-311.pyc differ
|
|
|
coder/config/agents.yaml
CHANGED
|
@@ -2,8 +2,8 @@ coder:
|
|
| 2 |
role: >
|
| 3 |
Python Coder
|
| 4 |
goal: >
|
| 5 |
-
You write python code to achieve this assignment: {assignment}
|
| 6 |
-
First you plan how the code will work, then you write the code, then you explain the code line by line in the language of the input language, then you run it and show the output.
|
| 7 |
backstory: >
|
| 8 |
You're a seasoned python developer with a knack for writing clean, efficient code.
|
| 9 |
llm: openai/gpt-4o-mini
|
|
|
|
| 2 |
role: >
|
| 3 |
Python Coder
|
| 4 |
goal: >
|
| 5 |
+
You write python code to achieve this assignment: {assignment} as comprehensive and complete as possible.
|
| 6 |
+
First you plan how the code will work in the language of the input language, then you write the code, then you explain the code line by line in the language of the input language, then you run it and show the output.
|
| 7 |
backstory: >
|
| 8 |
You're a seasoned python developer with a knack for writing clean, efficient code.
|
| 9 |
llm: openai/gpt-4o-mini
|
coder/config/tasks.yaml
CHANGED
|
@@ -2,5 +2,5 @@ coding_task:
|
|
| 2 |
description: >
|
| 3 |
Write a clean pyton code to achieve this: {assignment}
|
| 4 |
expected_output: >
|
| 5 |
-
A text file that includes the
|
| 6 |
agent: coder
|
|
|
|
| 2 |
description: >
|
| 3 |
Write a clean pyton code to achieve this: {assignment}
|
| 4 |
expected_output: >
|
| 5 |
+
A text file that includes the plan in the language of the input language, code itself, line by line explaination in the langue of the input, and finally the output of the code.
|
| 6 |
agent: coder
|
coder/crew.py
CHANGED
|
@@ -26,7 +26,7 @@ class Coder():
|
|
| 26 |
verbose=True,
|
| 27 |
allow_code_excution = True,
|
| 28 |
code_execution_mode = "safe",
|
| 29 |
-
max_execution_time =
|
| 30 |
max_retry_limit=5
|
| 31 |
)
|
| 32 |
|
|
|
|
| 26 |
verbose=True,
|
| 27 |
allow_code_excution = True,
|
| 28 |
code_execution_mode = "safe",
|
| 29 |
+
max_execution_time = 100,
|
| 30 |
max_retry_limit=5
|
| 31 |
)
|
| 32 |
|