File size: 2,348 Bytes
fc12014
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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)