File size: 366 Bytes
436c3a3
543fe4a
436c3a3
543fe4a
436c3a3
543fe4a
436c3a3
543fe4a
 
 
436c3a3
543fe4a
436c3a3
543fe4a
 
436c3a3
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
import loop

MODEL_ID = "TinyLlama/TinyLlama_v1.1_math_code"

handler = loop.EndpointHandler(MODEL_ID)

def respond(prompt, grammar):
    args = { "inputs": prompt, "grammar": grammar }
    return handler(prompt)

demo = gr.Interface(
    respond,
    inputs=["text", "text"],
    outputs=["text"]
)

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