John6666 commited on
Commit
ea919de
·
verified ·
1 Parent(s): ebc95ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -36
app.py CHANGED
@@ -1,37 +1,38 @@
1
- import os
2
- import gradio as gr
3
- from huggingface_hub import login
4
- from transformers import pipeline
5
-
6
- # Load the gated model
7
- #model_name = "RickyDeSkywalker/TheoremLlama"
8
- model_name = "unsloth/Llama-3.2-1B-Instruct"
9
- HF_TOKEN = os.environ.get("HF_TOKEN")
10
- #login(HF_TOKEN)
11
-
12
- generator = pipeline('text-generation', model=model_name, token=HF_TOKEN)
13
-
14
- # Function for generating Lean 4 code
15
- def generate_lean4_code(prompt):
16
- result = generator(prompt, max_length=1000, num_return_sequences=1)
17
- return result[0]['generated_text']
18
-
19
- # Gradio Interface
20
- title = "Lean 4 Code Generation with TheoremLlama"
21
- description = "Enter a natural language prompt to generate Lean 4 code."
22
-
23
- interface = gr.Interface(
24
- fn=generate_lean4_code,
25
- inputs=gr.Textbox(
26
- label="Prompt",
27
- placeholder="Prove that the sum of two even numbers is even.",
28
- lines=4
29
- ),
30
- #outputs=gr.Code(label="Generated Lean 4 Code", language="lean"),
31
- outputs=gr.Code(label="Generated Lean 4 Code"),
32
- title=title,
33
- description=description
34
- )
35
-
36
- # Launch the Gradio app
 
37
  interface.launch(ssr_mode=False)
 
1
+ import os
2
+ import gradio as gr
3
+ from huggingface_hub import login
4
+ from transformers import pipeline
5
+
6
+ # Load the gated model
7
+ #model_name = "RickyDeSkywalker/TheoremLlama"
8
+ #model_name = "unsloth/Llama-3.2-1B-Instruct"
9
+ model_name = "internlm/internlm2-math-plus-7b"
10
+ HF_TOKEN = os.environ.get("HF_TOKEN")
11
+ #login(HF_TOKEN)
12
+
13
+ generator = pipeline('text-generation', model=model_name, token=HF_TOKEN)
14
+
15
+ # Function for generating Lean 4 code
16
+ def generate_lean4_code(prompt):
17
+ result = generator(prompt, max_length=1000, num_return_sequences=1)
18
+ return result[0]['generated_text']
19
+
20
+ # Gradio Interface
21
+ title = "Lean 4 Code Generation with TheoremLlama"
22
+ description = "Enter a natural language prompt to generate Lean 4 code."
23
+
24
+ interface = gr.Interface(
25
+ fn=generate_lean4_code,
26
+ inputs=gr.Textbox(
27
+ label="Prompt",
28
+ placeholder="Prove that the sum of two even numbers is even.",
29
+ lines=4
30
+ ),
31
+ #outputs=gr.Code(label="Generated Lean 4 Code", language="lean"),
32
+ outputs=gr.Code(label="Generated Lean 4 Code"),
33
+ title=title,
34
+ description=description
35
+ )
36
+
37
+ # Launch the Gradio app
38
  interface.launch(ssr_mode=False)