dsfdfsghgf commited on
Commit
925025c
·
verified ·
1 Parent(s): fc74e70

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import AutoModelForCausalLM, AutoTokenizer
3
+
4
+ # Laden des Modells und des Tokenizers
5
+ model_name = "Qwen/Qwen2.5-Math"
6
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
7
+ model = AutoModelForCausalLM.from_pretrained(model_name)
8
+
9
+ # Gradio-Interface für Math-Lösungen
10
+ def solve_math(input_text):
11
+ inputs = tokenizer(input_text, return_tensors="pt")
12
+ outputs = model.generate(inputs["input_ids"])
13
+ return tokenizer.decode(outputs[0])
14
+
15
+ # Gradio App erstellen
16
+ iface = gr.Interface(
17
+ fn=solve_math,
18
+ inputs="text",
19
+ outputs="text",
20
+ title="SmartMath_AI",
21
+ description=" Ein KI-gestütztes Tool, das komplexe mathematische Berechnungen durchführt und intuitive Erklärungen liefert."
22
+ )
23
+
24
+ iface.launch()