Spaces:
Sleeping
Sleeping
import gradio as gr | |
import markdown | |
from main import run | |
# Create Gradio interface | |
def create_interface(): | |
with gr.Blocks(title="Tech News Agent", theme=gr.themes.Soft()) as app: | |
with gr.Column(scale=1): | |
gr.Markdown( | |
""" | |
# π Tech News Agent | |
This Agent will search, scrap and give comprehensive output about current Tech Update. | |
""" | |
) | |
# Input for Field/Topic | |
field = gr.Textbox( | |
label="Field", | |
placeholder="Your desired Field/Topic" | |
) | |
# Note for Field | |
field_note = gr.Accordion("Note for Field", open=False) | |
with field_note: | |
gr.Markdown( | |
""" | |
Choose a specific area you're interested in. Must Related to Tech, like AI,Software Dev,Hardware,ect. | |
""" | |
) | |
# Input for Since | |
since = gr.Textbox( | |
label="Since", | |
placeholder="Number of days since the update (e.g., 5)" | |
) | |
# Note for Since | |
since_note = gr.Accordion("Note for Since", open=False) | |
with since_note: | |
gr.Markdown( | |
""" | |
Enter the number of days ago you want updates from. | |
- **Example**: If you put "5," the agent will look for updates from the past 5 days. | |
- **Important**: If AI Can't find any info from the "since" day, it will look for the most recents news. | |
""" | |
) | |
submit_btn = gr.Button( | |
"Evaluate Responses", | |
variant="primary", | |
size="lg" | |
) | |
# Using Textbox instead of Markdown for better formatting | |
output = gr.Markdown( | |
label="Evaluation Results", | |
show_copy_button=True | |
) | |
submit_btn.click( | |
fn=run, | |
inputs=[field,since], | |
outputs=output | |
) | |
return app | |
if __name__ == "__main__": | |
app = create_interface() | |
app.launch(share=True) |