Draft 1: Building AMMA Learns AI on Hugging Face

  • Before writing a single line of code or picking a model, it helps to step back and ask some key questions. Building an AI-powered app is not just about plugging in a model — it’s about designing an experience with purpose.

    Flowchart: Steps to Build an AI-Powered Application

    Here’s a simplified blueprint that anyone can follow when building an AI app — whether it’s for storytelling, image generation, or predictions.

    Step-by-Step Structure

    1. Define the Problem Clearly
    What do you want the app to do?
    Who is it for?
    What should the output look like?

    2. Decide the Form of Output
    Should the output be text, an image, audio, or something interactive?

    3. Identify Required Components

    • Do you need a language or vision model?

    • Will the app have a user interface?

    • Is speed or latency important?

    • Do you need to store responses, track users, or support feedback?

    4. Choose the Right Tools for Each Part

    • Model: Which AI model or API will generate your output?

    • Platform: Where will you host the app (e.g. Hugging Face, Streamlit, AWS)?

    • Interface: How will users interact (e.g. Gradio, custom frontend)?

    • Integration: How will these parts connect (API calls, Python backend, etc.)?

    5. Build, Test, and Refine
    Start with a minimal version. Test how well the model performs. Tweak your prompts or logic based on feedback.

    6. Polish the User Experience
    Make it smooth and welcoming. Add structure, visuals, voice output, or anything else that makes it easier to use.

    7. Deploy and Share
    Host your app, make it public (or private), and share it with your users.

Now that you’ve seen the structure, here’s how I built my own app.

The Problem Statement:

I wanted to build a web app that helps anyone understand AI and machine learning concepts — not with technical definitions, but through storytelling.

The idea was simple:
Let users type in any AI or ML concept and get a short, friendly story between Amma (a curious mother) and Meenu (her data scientist daughter). No jargon. Just a natural, human conversation.

Choosing the Tools:

1. Model: HuggingFaceH4/zephyr-7b-beta

For this application, I selected HuggingFaceH4/zephyr-7b-beta, a compact instruction-tuned language model hosted on Hugging Face. The choice was based on several key factors. Zephyr is trained to follow human-written instructions effectively, which makes it particularly well-suited for conversational tasks and storytelling formats. Its instruction tuning allows it to generalize better to specific tasks without requiring additional fine-tuning, which was ideal for my use case. Since I wasn’t training a model from scratch, I relied entirely on prompt engineering — the practice of designing structured input prompts that guide the model to generate contextually relevant and high-quality outputs. Prompt engineering can be seen as a lightweight alternative to model fine-tuning, where the intelligence is not in changing the model’s parameters but in how you frame the task and constraints in natural language. Zephyr’s compatibility with Hugging Face’s Inference API also ensured manageable latency and cost, making it accessible for a solo builder like me. The model's ability to produce clear, natural-sounding text with minimal setup made it an ideal fit for generating scripted dialogues between Amma and Meenu, where tone, warmth, and clarity matter just as much as technical accuracy.

2. Prompt Engineering

This part of the project turned out to be the most challenging and also the most critical. My goal was to generate a conversation that felt genuine — something that resembled a real exchange between Amma and Meenu, not just an AI-generated explanation disguised as dialogue. Early attempts fell flat. The model often failed to let Amma initiate the conversation, which made the story feel unnatural. In other cases, Meenu came across as stiff or overly formal, losing the warmth that was central to the experience. There were also instances where the model skipped the storytelling altogether and jumped straight into textbook-style definitions, completely bypassing the narrative aspect. Achieving the right tone, rhythm, and structure took a surprising amount of iteration. After around twenty-three different prompt versions, I finally arrived at one that reliably produced engaging, structured, and emotionally balanced dialogue. To further polish the output, I implemented backend filters to remove stage directions like parentheses containing expressions or technical markers such as “====END====” that occasionally appeared in the response. These small but necessary steps helped transform the raw output into something that felt thoughtfully written — a story that could genuinely connect with someone like my Amma.

3. Interface: Gradio

To build the user interface for the app, I used Gradio, a Python library designed to simplify the process of creating web frontends for machine learning models. Gradio allowed me to accept user input in the form of ML concepts and immediately display the generated story in response, all within a clean and responsive interface. What made it especially useful was how quickly I could build and iterate on the app without writing any frontend code from scratch. Its flexibility and ease of use made it possible to go from idea to deployment in just a few hours. More importantly, Gradio integrates seamlessly with Hugging Face Spaces, which means I could host and share the app publicly with minimal configuration. For a solo developer working on an AI project with storytelling at its heart, it turned out to be the perfect tool for bringing Amma and Meenu’s conversations to life.

4. Hosting: Hugging Face Spaces

I deployed the entire application on Hugging Face Spaces, which turned out to be an ideal platform for hosting both the model and the user interface in one place. It allowed me to manage all dependencies within a single environment, which significantly simplified setup and maintenance. The seamless integration between the backend model, Gradio-based UI, and deployment infrastructure meant I didn’t have to worry about wiring everything together manually. Hosting the app on Spaces also made it instantly accessible and easy to share with others, whether for feedback, demo purposes, or real-world use. Having everything consolidated in a single ecosystem made debugging, updating, and iterating on the app much smoother, especially as I continued refining both the model’s output and the user experience.

Challenges Along the Way

One of the most difficult parts of building this application was crafting a prompt that felt truly human. I didn’t want Meenu to sound like a textbook, and I didn’t want Amma to feel like a placeholder for a generic user. The goal was to simulate a warm, natural conversation — and that turned out to be far more challenging than expected. Prompting wasn’t just about giving instructions to the model. It required constant rewriting, subtle tone adjustments, and repeated testing to avoid robotic or overly formal responses.

Even after getting a prompt that generally worked, there were structural issues that kept creeping in. The model would sometimes repeat itself, rush into explaining the concept before the conversation even began, or end the dialogue abruptly. Maintaining a natural flow while keeping the story logically structured became a delicate balancing act.

Another issue I encountered was performance. Since the app queries the model in real time using Hugging Face’s inference API, response times can vary, especially on the free tier. At times, it feels slow enough that users might think it’s unresponsive, which is something I want to improve in future versions.

There were also limitations on the user interface side. While the current app works, it’s minimal and purely text-based. For a target audience like Amma — someone not comfortable with tech — the experience needs to feel more welcoming and immersive. I want to bring in visual elements and perhaps even audio features to make it more accessible and engaging.

Lastly, the storytelling right now is entirely one-way. The user reads the explanation, and that’s it. But I’d love to add an interactive layer where the app asks questions or offers small quizzes at the end of each story. That way, learning becomes more reflective and active rather than passive. These are just a few of the areas I plan to improve as the project evolves.

The Current Prompt

Here’s the exact prompt I’m using in the app:

Generate a natural, flowing conversation between Amma and Meenu in script format.
Amma casually asks Meenu about the concept: '{concept}'.
Meenu explains it in a way that feels intuitive and clear to Amma, drawing from daily experiences without making it feel like a lecture.
Avoid stating or acknowledging that examples are being used — just weave them into the dialogue.
Start the conversation with a casual moment, and let it evolve into the explanation naturally.
Keep the tone light, friendly, and engaging, and wrap up the conversation with a satisfying, conversational closing.
Do not include any part of this prompt in the output.
Limit the total output to 700 tokens.
The conversation should begin after this line:
==== BEGIN ====

This is followed by filters that remove any leftover formatting or narration artifacts.

What’s Next

This started as a way for me to revise ML concepts, but now it's turning into something more — a tool that can make AI feel accessible to anyone.

  • A better interface with images, colors, and Amma/Meenu character art

  • Optional voice output for accessibility

  • A quiz or reflection section at the end of each story

  • Support for other characters and regional languages

  • The ability to upload text or articles and convert them into Amma-style conversations

  • A faster backend using Hugging Face’s inference server or other optimized hosting

Try It Live

You can explore the current version here: https://huggingface.co/spaces/BhavyaSamhithaMallineni/AmmaLearnsAI

Next
Next

Why I Started AMMA Learns AI