Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,36 +1,28 @@
|
|
| 1 |
import spaces
|
| 2 |
-
import gradio as gr
|
| 3 |
from model_runner import ModelRunner
|
| 4 |
from parser import parse_to_files
|
| 5 |
from zip_util import make_zip_from_files
|
| 6 |
-
import
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
runner = ModelRunner(MODEL_PATH)
|
| 13 |
|
| 14 |
-
@spaces.GPU(duration=120)
|
| 15 |
-
def process_and_zip(ai_response: str)
|
| 16 |
-
"""
|
| 17 |
-
Given the pasted AI response, do model interpretation → parse → zip → return zip path
|
| 18 |
-
"""
|
| 19 |
model_output = runner.interpret_code_description(ai_response)
|
| 20 |
file_list = parse_to_files(model_output)
|
| 21 |
zip_path = make_zip_from_files(file_list)
|
| 22 |
return zip_path
|
| 23 |
|
| 24 |
with gr.Blocks() as demo:
|
| 25 |
-
gr.Markdown("### Paste your AI
|
| 26 |
-
input_box = gr.Textbox(lines=15, placeholder="Paste AI
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
value=lambda resp: resp, # will be provided after processing
|
| 30 |
-
)
|
| 31 |
-
submit = gr.Button("Generate Code Bundle")
|
| 32 |
|
| 33 |
-
|
| 34 |
-
submit.click(fn=process_and_zip, inputs=input_box, outputs=output_zip)
|
| 35 |
|
| 36 |
demo.launch()
|
|
|
|
| 1 |
import spaces
|
|
|
|
| 2 |
from model_runner import ModelRunner
|
| 3 |
from parser import parse_to_files
|
| 4 |
from zip_util import make_zip_from_files
|
| 5 |
+
import gradio as gr
|
| 6 |
|
| 7 |
+
# Same model you referenced
|
| 8 |
+
MODEL_REPO = "tHottie/NeuralDaredevil-8B-abliterated-Q4_K_M-GGUF"
|
| 9 |
+
MODEL_FILE = "neuraldaredevil-8b-abliterated-q4_k_m-imat.gguf"
|
| 10 |
|
| 11 |
+
runner = ModelRunner(repo_id=MODEL_REPO, filename=MODEL_FILE)
|
|
|
|
| 12 |
|
| 13 |
+
@spaces.GPU(duration=120)
|
| 14 |
+
def process_and_zip(ai_response: str):
|
|
|
|
|
|
|
|
|
|
| 15 |
model_output = runner.interpret_code_description(ai_response)
|
| 16 |
file_list = parse_to_files(model_output)
|
| 17 |
zip_path = make_zip_from_files(file_list)
|
| 18 |
return zip_path
|
| 19 |
|
| 20 |
with gr.Blocks() as demo:
|
| 21 |
+
gr.Markdown("### Paste your AI output with multiple files below:")
|
| 22 |
+
input_box = gr.Textbox(lines=15, placeholder="Paste codegen or AI output here...")
|
| 23 |
+
submit = gr.Button("Generate Zip")
|
| 24 |
+
download = gr.File(label="Download zip")
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
submit.click(fn=process_and_zip, inputs=input_box, outputs=download)
|
|
|
|
| 27 |
|
| 28 |
demo.launch()
|