Spaces:
Sleeping
Sleeping
File size: 758 Bytes
4bb9d41 3954ed4 4bb9d41 3954ed4 4bb9d41 3954ed4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
from ..model.model import NigerianLanguageModel
from ..model.config import ModelConfig
def create_interface(model: NigerianLanguageModel):
def generate_text(prompt: str, language: str) -> str:
tagged_prompt = f"[{language.upper()}] {prompt}"
return model.generate(tagged_prompt)
interface = gr.Interface(
fn=generate_text,
inputs=[
gr.Textbox(label="Enter your prompt"),
gr.Dropdown(choices=model.config.languages, label="Select Language")
],
outputs=gr.Textbox(label="Generated Text"),
title="Nigerian Language Generator",
description="Generate text in Yoruba, Igbo, or Hausa using a fine-tuned GPT model."
)
return interface
|