Spaces:
Runtime error
Runtime error
import gradio as gr | |
import os | |
def test_model(input_text): | |
"""Simple test function""" | |
if not input_text.strip(): | |
return "Please enter some text to test." | |
# Simple echo response for now | |
return f"Echo: {input_text} (Model: tasal9/ZamAI-Mistral-7B-Pashto)" | |
def train_model(dataset_text): | |
"""Training function""" | |
if not dataset_text.strip(): | |
return "Please provide training data." | |
return f"Training started for tasal9/ZamAI-Mistral-7B-Pashto\nData length: {len(dataset_text)} characters" | |
def finetune_model(dataset_text): | |
"""Fine-tuning function""" | |
if not dataset_text.strip(): | |
return "Please provide fine-tuning data." | |
return f"Fine-tuning started for tasal9/ZamAI-Mistral-7B-Pashto\nData length: {len(dataset_text)} characters" | |
# Create interface | |
with gr.Blocks(title="ZamAI-Mistral-7B-Pashto") as demo: | |
gr.Markdown(f"# ZamAI-Mistral-7B-Pashto Training Space") | |
with gr.Tab("Test"): | |
with gr.Row(): | |
test_input = gr.Textbox(label="Input", lines=2) | |
test_output = gr.Textbox(label="Output", lines=2) | |
test_btn = gr.Button("Test") | |
test_btn.click(test_model, inputs=test_input, outputs=test_output) | |
with gr.Tab("Train"): | |
train_input = gr.Textbox(label="Training Data", lines=5) | |
train_output = gr.Textbox(label="Training Status", lines=3) | |
train_btn = gr.Button("Start Training") | |
train_btn.click(train_model, inputs=train_input, outputs=train_output) | |
with gr.Tab("Fine-tune"): | |
finetune_input = gr.Textbox(label="Fine-tuning Data", lines=5) | |
finetune_output = gr.Textbox(label="Fine-tuning Status", lines=3) | |
finetune_btn = gr.Button("Start Fine-tuning") | |
finetune_btn.click(finetune_model, inputs=finetune_input, outputs=finetune_output) | |
if __name__ == "__main__": | |
demo.launch() | |