dp1812's picture
Upload app.py with huggingface_hub
18c86ea verified
import gradio as gr
import subprocess
import os
def train_model():
"""Start training the CELESTIAL model"""
try:
result = subprocess.run(["python", "train_celestial.py"],
capture_output=True, text=True, timeout=3600)
return f"Training Output:\n{result.stdout}\n\nErrors:\n{result.stderr}"
except Exception as e:
return f"Training failed: {e}"
def test_model(prompt):
"""Test the trained model"""
# This would load and test the trained model
return f"Testing with prompt: {prompt}\n\nThis is a placeholder response."
# Create Gradio interface
with gr.Blocks(title="CELESTIAL Mistral 7B v0.3 Training") as demo:
gr.Markdown("# 🌟 CELESTIAL Spiritual AI Training")
gr.Markdown("Train and test Mistral 7B v0.3 for comprehensive spiritual guidance")
with gr.Tab("Training"):
train_btn = gr.Button("πŸš€ Start Training", variant="primary")
train_output = gr.Textbox(label="Training Output", lines=20)
train_btn.click(train_model, outputs=train_output)
with gr.Tab("Testing"):
test_input = gr.Textbox(label="Test Prompt",
placeholder="What is the significance of Om mantra?")
test_btn = gr.Button("πŸ§ͺ Test Model")
test_output = gr.Textbox(label="Model Response", lines=10)
test_btn.click(test_model, inputs=test_input, outputs=test_output)
if __name__ == "__main__":
demo.launch()