File size: 754 Bytes
0cf83e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from model_service import ask_ai

def respond(user_input):
    if not user_input or not user_input.strip():
        return ""
    return ask_ai(user_input)

with gr.Blocks() as demo:
    gr.Markdown(
        """
        # 🤖 Groq AI App  
        **Powered by LLaMA 3.3 via Groq**  
        Ask anything below 👇
        """
    )

    user_input = gr.Textbox(
        label="Your Question",
        placeholder="Type your question here...",
        lines=2
    )

    output = gr.Textbox(
        label="AI Response",
        lines=6,
        interactive=False
    )

    ask_btn = gr.Button("Ask", variant="primary")

    ask_btn.click(
        fn=respond,
        inputs=user_input,
        outputs=output
    )

demo.launch()