Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
outputs=gr.Code(label="Generated Lean 4 Code"),
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
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)
|