File size: 808 Bytes
6ff2499
674e436
6ff2499
57c7d18
674e436
ec9d3dc
57c7d18
674e436
57c7d18
674e436
 
 
 
 
 
322a100
674e436
 
 
 
 
 
 
 
322a100
674e436
 
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 transformers import AutoTokenizer, AutoModelForCausalLM

# Load your model from Hugging Face Transformers
model_name = "deepseek-ai/DeepSeek-V2-Lite"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

# Define a function to use the model
def math_inference(input_text):
    inputs = tokenizer(input_text, return_tensors="pt")
    output = model.generate(**inputs)
    response = tokenizer.decode(output[0], skip_special_tokens=True)
    return response

# Create a Gradio interface
iface = gr.Interface(
    fn=math_inference,
    inputs=gr.Textbox(prompt="Input math question"),
    outputs=gr.Textbox(prompt="Math answer"),
    layout="vertical",
    title="Math Solver"
)

# Launch the Gradio interface
iface.launch()