Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import subprocess
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
def train_model():
|
| 6 |
+
"""Start training the CELESTIAL model"""
|
| 7 |
+
try:
|
| 8 |
+
result = subprocess.run(["python", "train_celestial.py"],
|
| 9 |
+
capture_output=True, text=True, timeout=3600)
|
| 10 |
+
return f"Training Output:\n{result.stdout}\n\nErrors:\n{result.stderr}"
|
| 11 |
+
except Exception as e:
|
| 12 |
+
return f"Training failed: {e}"
|
| 13 |
+
|
| 14 |
+
def test_model(prompt):
|
| 15 |
+
"""Test the trained model"""
|
| 16 |
+
# This would load and test the trained model
|
| 17 |
+
return f"Testing with prompt: {prompt}\n\nThis is a placeholder response."
|
| 18 |
+
|
| 19 |
+
# Create Gradio interface
|
| 20 |
+
with gr.Blocks(title="CELESTIAL Mistral 7B v0.3 Training") as demo:
|
| 21 |
+
gr.Markdown("# 🌟 CELESTIAL Spiritual AI Training")
|
| 22 |
+
gr.Markdown("Train and test Mistral 7B v0.3 for comprehensive spiritual guidance")
|
| 23 |
+
|
| 24 |
+
with gr.Tab("Training"):
|
| 25 |
+
train_btn = gr.Button("🚀 Start Training", variant="primary")
|
| 26 |
+
train_output = gr.Textbox(label="Training Output", lines=20)
|
| 27 |
+
train_btn.click(train_model, outputs=train_output)
|
| 28 |
+
|
| 29 |
+
with gr.Tab("Testing"):
|
| 30 |
+
test_input = gr.Textbox(label="Test Prompt",
|
| 31 |
+
placeholder="What is the significance of Om mantra?")
|
| 32 |
+
test_btn = gr.Button("🧪 Test Model")
|
| 33 |
+
test_output = gr.Textbox(label="Model Response", lines=10)
|
| 34 |
+
test_btn.click(test_model, inputs=test_input, outputs=test_output)
|
| 35 |
+
|
| 36 |
+
if __name__ == "__main__":
|
| 37 |
+
demo.launch()
|