Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- README.md +13 -12
- app.py +36 -0
- requirements.txt +1 -0
README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
-
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 5.
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
1 |
+
---
|
2 |
+
title: Demo Prover
|
3 |
+
emoji: 🐠
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: yellow
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 5.6.0
|
8 |
+
python_version: 3.11
|
9 |
+
app_file: app.py
|
10 |
+
pinned: false
|
11 |
+
license: mit
|
12 |
+
short_description: nl -> fl
|
13 |
+
---
|
app.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
title=title,
|
32 |
+
description=description
|
33 |
+
)
|
34 |
+
|
35 |
+
# Launch the Gradio app
|
36 |
+
interface.launch(ssr_mode=False)
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
huggingface_hub
|