File size: 798 Bytes
a9aecd6
b9c4c1d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8536ecc
b9c4c1d
 
 
a9aecd6
 
 
b9c4c1d
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
import gradio as gr
from lunacode import smart_luna_answer

def respond(
    message,
    history: list[tuple[str, str]],
    system_message,
    max_tokens,
):
    try:
        result = smart_luna_answer(message, max_tokens=max_tokens)
        return result
    except Exception as e:
        return f"Error: {str(e)}"

demo = gr.ChatInterface(
    fn=respond,
    additional_inputs=[
        gr.Textbox(value="You are a helpful AI assistant.", label="System message"),
        gr.Slider(minimum=128, maximum=2048, value=512, step=1, label="Max new tokens"),
    ],
    title="Luna AI — Code & Web Enhanced Assistant",
    description="Ask Luna questions, generate code, and explore smart AI-powered answers with web context!",
    theme="default"
)

if __name__ == "__main__":
    demo.launch()