Spaces:
Sleeping
Sleeping
Update src/tech_news/app.py
Browse files- src/tech_news/app.py +69 -69
src/tech_news/app.py
CHANGED
@@ -1,69 +1,69 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import markdown
|
3 |
-
from main import run
|
4 |
-
|
5 |
-
|
6 |
-
# Create Gradio interface
|
7 |
-
def create_interface():
|
8 |
-
with gr.Blocks(title="Tech News Agent", theme=gr.themes.Soft()) as app:
|
9 |
-
with gr.Column(scale=1):
|
10 |
-
gr.Markdown(
|
11 |
-
"""
|
12 |
-
# 📝 Tech News Agent
|
13 |
-
This Agent will search, scrap and give comprehensive output about current Tech Update.
|
14 |
-
"""
|
15 |
-
)
|
16 |
-
|
17 |
-
# Input for Field/Topic
|
18 |
-
field = gr.Textbox(
|
19 |
-
label="Field",
|
20 |
-
placeholder="Your desired Field/Topic"
|
21 |
-
)
|
22 |
-
# Note for Field
|
23 |
-
field_note = gr.Accordion("Note for Field", open=False)
|
24 |
-
with field_note:
|
25 |
-
gr.Markdown(
|
26 |
-
"""
|
27 |
-
Choose a specific area you're interested in. Must Related to Tech, like AI,Software Dev,Hardware,ect.
|
28 |
-
"""
|
29 |
-
)
|
30 |
-
|
31 |
-
# Input for Since
|
32 |
-
since = gr.Textbox(
|
33 |
-
label="Since",
|
34 |
-
placeholder="Number of days since the update (e.g., 5)"
|
35 |
-
)
|
36 |
-
# Note for Since
|
37 |
-
since_note = gr.Accordion("Note for Since", open=False)
|
38 |
-
with since_note:
|
39 |
-
gr.Markdown(
|
40 |
-
"""
|
41 |
-
Enter the number of days ago you want updates from.
|
42 |
-
- **Example**: If you put "5," the agent will look for updates from the past 5 days.
|
43 |
-
- **Important**: If AI Can't find any info from the "since" day, it will look for the most recents news.
|
44 |
-
"""
|
45 |
-
)
|
46 |
-
|
47 |
-
submit_btn = gr.Button(
|
48 |
-
"Evaluate Responses",
|
49 |
-
variant="primary",
|
50 |
-
size="lg"
|
51 |
-
)
|
52 |
-
|
53 |
-
# Using Textbox instead of Markdown for better formatting
|
54 |
-
output = gr.Markdown(
|
55 |
-
label="Evaluation Results",
|
56 |
-
show_copy_button=True
|
57 |
-
)
|
58 |
-
|
59 |
-
submit_btn.click(
|
60 |
-
fn=run,
|
61 |
-
inputs=[field,since],
|
62 |
-
outputs=output
|
63 |
-
)
|
64 |
-
|
65 |
-
return app
|
66 |
-
|
67 |
-
if __name__ == "__main__":
|
68 |
-
app = create_interface()
|
69 |
-
app.launch(
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import markdown
|
3 |
+
from main import run
|
4 |
+
|
5 |
+
|
6 |
+
# Create Gradio interface
|
7 |
+
def create_interface():
|
8 |
+
with gr.Blocks(title="Tech News Agent", theme=gr.themes.Soft()) as app:
|
9 |
+
with gr.Column(scale=1):
|
10 |
+
gr.Markdown(
|
11 |
+
"""
|
12 |
+
# 📝 Tech News Agent
|
13 |
+
This Agent will search, scrap and give comprehensive output about current Tech Update.
|
14 |
+
"""
|
15 |
+
)
|
16 |
+
|
17 |
+
# Input for Field/Topic
|
18 |
+
field = gr.Textbox(
|
19 |
+
label="Field",
|
20 |
+
placeholder="Your desired Field/Topic"
|
21 |
+
)
|
22 |
+
# Note for Field
|
23 |
+
field_note = gr.Accordion("Note for Field", open=False)
|
24 |
+
with field_note:
|
25 |
+
gr.Markdown(
|
26 |
+
"""
|
27 |
+
Choose a specific area you're interested in. Must Related to Tech, like AI,Software Dev,Hardware,ect.
|
28 |
+
"""
|
29 |
+
)
|
30 |
+
|
31 |
+
# Input for Since
|
32 |
+
since = gr.Textbox(
|
33 |
+
label="Since",
|
34 |
+
placeholder="Number of days since the update (e.g., 5)"
|
35 |
+
)
|
36 |
+
# Note for Since
|
37 |
+
since_note = gr.Accordion("Note for Since", open=False)
|
38 |
+
with since_note:
|
39 |
+
gr.Markdown(
|
40 |
+
"""
|
41 |
+
Enter the number of days ago you want updates from.
|
42 |
+
- **Example**: If you put "5," the agent will look for updates from the past 5 days.
|
43 |
+
- **Important**: If AI Can't find any info from the "since" day, it will look for the most recents news.
|
44 |
+
"""
|
45 |
+
)
|
46 |
+
|
47 |
+
submit_btn = gr.Button(
|
48 |
+
"Evaluate Responses",
|
49 |
+
variant="primary",
|
50 |
+
size="lg"
|
51 |
+
)
|
52 |
+
|
53 |
+
# Using Textbox instead of Markdown for better formatting
|
54 |
+
output = gr.Markdown(
|
55 |
+
label="Evaluation Results",
|
56 |
+
show_copy_button=True
|
57 |
+
)
|
58 |
+
|
59 |
+
submit_btn.click(
|
60 |
+
fn=run,
|
61 |
+
inputs=[field,since],
|
62 |
+
outputs=output
|
63 |
+
)
|
64 |
+
|
65 |
+
return app
|
66 |
+
|
67 |
+
if __name__ == "__main__":
|
68 |
+
app = create_interface()
|
69 |
+
app.launch()
|