Spaces:
Sleeping
Sleeping
Update app.py
Browse files12345678910111213from transformers import pipeline# Load the fine-tuned model from Hugging Facegenerator = pipeline("text2text-generation", model="DetectiveShadow/inspiration-message-generator")# Define test promptprompt = "Age: 32 | Profession: Engineer | Archetype: Innovator"# Run modelresult = generator(prompt, max_new_tokens=100)[0]["generated_text"]# Print outputprint(result)12345678910111213141516171819202122232425262728import gradio as grfrom transformers import pipeline# Load your model from the Hubgenerator = pipeline("text2text-generation", model="DetectiveShadow/inspiration-message-generator")# Define your message functiondef generate_inspiration(age, profession, archetype):prompt = f"Age: {age} | Profession: {profession} | Archetype: {archetype}"result = generator(prompt, max_new_tokens=100)[0]["generated_text"]return result# Gradio interface layoutiface = gr.Interface(fn=generate_inspiration,inputs=[gr.Textbox(label="Age"),gr.Textbox(label="Profession"),gr.Textbox(label="Archetype")],outputs=gr.Textbox(label="Inspirational Message"),title="Inspiration Message Generator",description="Enter your age, profession, and archetype to receive a personalized message.")# Run the appiface.launch()
app.py+22-7