zej97 commited on
Commit
b80d291
·
1 Parent(s): 241d2a5

Upload folder using huggingface_hub

Browse files
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
agent/__pycache__/research_agent.cpython-311.pyc CHANGED
Binary files a/agent/__pycache__/research_agent.cpython-311.pyc and b/agent/__pycache__/research_agent.cpython-311.pyc differ
 
agent/research_agent.py CHANGED
@@ -102,7 +102,7 @@ class ResearchAgent:
102
  Args: None
103
  Returns: str: The report for the given question
104
  """
105
- yield "Searching online..."
106
 
107
  report_type_func = prompts.get_report_by_type(report_type)
108
 
 
102
  Args: None
103
  Returns: str: The report for the given question
104
  """
105
+ # yield "Searching online..."
106
 
107
  report_type_func = prompts.get_report_by_type(report_type)
108
 
app.py CHANGED
@@ -5,17 +5,21 @@ from agent.research_agent import ResearchAgent
5
  from agent.toolkits import english_polishing
6
  from statics.style import *
7
 
8
- theme = gr.themes.Soft(
9
- primary_hue=gr.themes.Color(c100="#e0e7ff", c200="#c7d2fe", c300="#a5b4fc", c400="#818cf8", c50="#eef2ff", c500="#6366f1", c600="#5e5aaa", c700="#4338ca", c800="#3730a3", c900="#312e81", c950="#2b2c5e"),
10
- font_mono=[gr.themes.GoogleFont('Fira Code'), 'ui-monospace', 'Consolas', 'monospace']
11
- )
12
 
13
  check_openai_api_key()
 
 
 
 
14
 
15
  def run_agent(task, agent, report_type):
 
 
 
16
  assistant = ResearchAgent(task, agent)
17
  yield from assistant.write_report(report_type)
18
 
 
19
  with gr.Blocks(theme=gr.themes.Base(),
20
  title="AI Research Assistant",
21
  css=css) as demo:
@@ -44,17 +48,33 @@ with gr.Blocks(theme=gr.themes.Base(),
44
  interactive=True,
45
  allow_custom_value=False,
46
  choices=["Research Report",
47
- "Resource Report",
48
- "Outline Report"])
 
49
  input_box = gr.Textbox(label="# What would you like to research next?", placeholder="Enter your question here")
50
- submit_btn = gr.Button("Generate Report")
51
- submit_btn.click(run_agent, inputs=[input_box, agent_type, report_type],
52
- outputs=research_report)
53
  gr.Examples(["Should I invest in the Large Language Model industry in 2023?",
54
  "Is it advisable to make investments in the electric car industry during the year 2023?",
55
  "What constitutes the optimal approach for investing in the Bitcoin industry during the year 2023?",
56
  "What are the most recent advancements in the domain of superconductors as of 2023?"],
57
  inputs=input_box)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  with gr.Tab("English Polishing"):
60
  gr.HTML(english_polishing_html)
@@ -62,8 +82,8 @@ with gr.Blocks(theme=gr.themes.Base(),
62
  sentences = gr.Textbox(label="# What would you like to polish?", placeholder="Enter your sentence here")
63
 
64
  with gr.Row():
65
- polish_btn = gr.Button("Polish")
66
- save_btn = gr.Button("Save")
67
 
68
  polish_btn.click(english_polishing, inputs=[sentences], outputs=polished_result)
69
 
 
5
  from agent.toolkits import english_polishing
6
  from statics.style import *
7
 
 
 
 
 
8
 
9
  check_openai_api_key()
10
+ history = ""
11
+ history_num = 0
12
+ history_tasks = []
13
+ max_histroy_num = 30
14
 
15
  def run_agent(task, agent, report_type):
16
+ global history, history_num, history_tasks
17
+ history_num += 1
18
+ history_tasks.append(task)
19
  assistant = ResearchAgent(task, agent)
20
  yield from assistant.write_report(report_type)
21
 
22
+
23
  with gr.Blocks(theme=gr.themes.Base(),
24
  title="AI Research Assistant",
25
  css=css) as demo:
 
48
  interactive=True,
49
  allow_custom_value=False,
50
  choices=["Research Report",
51
+ "Resource Report",
52
+ "Outline Report"])
53
+
54
  input_box = gr.Textbox(label="# What would you like to research next?", placeholder="Enter your question here")
55
+ submit_btn = gr.Button("Generate Report", elem_id="primary-btn")
56
+
 
57
  gr.Examples(["Should I invest in the Large Language Model industry in 2023?",
58
  "Is it advisable to make investments in the electric car industry during the year 2023?",
59
  "What constitutes the optimal approach for investing in the Bitcoin industry during the year 2023?",
60
  "What are the most recent advancements in the domain of superconductors as of 2023?"],
61
  inputs=input_box)
62
+
63
+ with gr.Accordion(label="# Research History (Max 30)", elem_id="history", open=False):
64
+ research_history = gr.Markdown()
65
+
66
+ def store_research(content):
67
+ global history_num, history_tasks, history
68
+ if 0 < history_num <= max_histroy_num:
69
+ history += f'<details>\
70
+ <summary>Research History {history_num}: <i>{history_tasks[-1]}</i></summary>\
71
+ <div id="history_box">{content}</div>\
72
+ </details>'
73
+ return history
74
+
75
+ submit_btn.click(run_agent, inputs=[input_box, agent_type, report_type], outputs=research_report)\
76
+ .then(store_research, inputs=[research_report], outputs=research_history)
77
+
78
 
79
  with gr.Tab("English Polishing"):
80
  gr.HTML(english_polishing_html)
 
82
  sentences = gr.Textbox(label="# What would you like to polish?", placeholder="Enter your sentence here")
83
 
84
  with gr.Row():
85
+ polish_btn = gr.Button("Polish", elem_id="primary-btn")
86
+ save_btn = gr.Button("Save", elem_id="primary-btn")
87
 
88
  polish_btn.click(english_polishing, inputs=[sentences], outputs=polished_result)
89
 
statics/__pycache__/style.cpython-311.pyc CHANGED
Binary files a/statics/__pycache__/style.cpython-311.pyc and b/statics/__pycache__/style.cpython-311.pyc differ
 
statics/style.py CHANGED
@@ -34,10 +34,31 @@ css = """
34
  .output {
35
  padding: 10px;
36
  min-height: 200px;
37
- border: #c0c0c0 1px solid;
38
- border-radius: 5px;
39
  margin-bottom: 10px;
40
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  """
42
 
43
  top_bar = """
 
34
  .output {
35
  padding: 10px;
36
  min-height: 200px;
37
+ border: 1.5px solid #9A73B5;
38
+ border-radius: 10px;
39
  margin-bottom: 10px;
40
  }
41
+
42
+ #history {
43
+ padding: 10px;
44
+ border: 1.5px dashed #9A73B5;
45
+ border-radius: 10px;
46
+ }
47
+
48
+ #primary-btn {
49
+ border: 1.5px solid #9A73B5;
50
+ font-size: 20px;
51
+ }
52
+
53
+ summary {
54
+ font-size: 14px;
55
+ font-weight: bold;
56
+ }
57
+
58
+ #history_box {
59
+ border-bottom: 1.5px dashed #9A73B5;
60
+ padding: 10px;
61
+ }
62
  """
63
 
64
  top_bar = """