DEV Community

Cover image for From Industry to University: Building 'TariffIntellect' with Gemini & Antigravity
Ihsan Andrinal
Ihsan Andrinal

Posted on

From Industry to University: Building 'TariffIntellect' with Gemini & Antigravity

New Year, New You Portfolio Challenge Submission

This is a submission for the New Year, New You Portfolio Challenge Presented by Google AI

About Me

For 2026, I am embracing a leverage in my career: evolving from a trade policy expert into a Domain-Expert Developer.

Currently, I am a Master of Information Technology student researching the intersection of Artificial Intelligence and International Trade Law. With over 10 years of professional experience in the trade facilitation industry, I realized that policy expertise alone isn't enough to modernize global trade.

My unique style is "Pragmatic Innovation." I don't just build code for the sake of coding; I build code to solve specific, high-stakes legal problems. My portfolio expresses my goal to bridge the gap between legal policy and modern technology using Neuro-Symbolic AI.

Portfolio

Here is TariffIntellect, a "Human-in-the-Loop" AI prototype deployed on Google Cloud Run. It demonstrates how AI can be used safely in regulated industries by combining visual recognition with a strict audit trail.

How I Built It

To build this prototype in record time (under 24 hours!), I leveraged the full power of Google's modern development ecosystem.

The Tech Stack:

  • AI Model: Google Gemini 2.0 Flash (via google-generativeai SDK).
  • IDE: Google Antigravity (Project IDX).
  • Backend/Frontend: Python 3.11 & Streamlit.
  • Infrastructure: Google Cloud Run (Dockerized).

🧠 The "Smart Routing" Logic

One feature I didn't want to compromise on was flexibility. The app follows a Smart Routing Architecture similar to real-world Customs lanes:

  1. The Green Lane (AI Autopilot):
    If a user uploads a general item (e.g., a Shoe), the system detects no conflict in the ambiguity_map.json. In this case, Gemini 2.0 Flash automatically analyzes the image and generates the HS Code using its vast internal knowledge base.
    Analyze the shoe

  2. The Red Lane (Human Intervention):
    If the system detects a high-risk keyword (like "Knife" or "Drone"), it triggers the Ambiguity Engine. The AI pauses, presents the specific legal conflict to the user, and waits for human input before finalizing the classification.
    Logic that trigger ambiguity engine

Development Process:

  1. Rapid Scaffolding with Antigravity: I used Google's AI-first IDE to generate the initial project structure. By prompting the agent to "Create a Streamlit app structure with an ambiguity_map.json for logic handling," I skipped minutes of boilerplate setup.
    Antigravity Editor

  2. Connecting the "Eyes": I integrated Gemini 2.0 Flash to act as the visual sensor. It identifies objects rapidly before passing the data to my Python logic.

  3. Deploying to Cloud Run: I used the gcloud CLI to deploy the container directly from my terminal, ensuring the app is scalable and publicly accessible.

# My deployment command used for this challenge
gcloud run deploy tariff-intellect \
  --source . \
  --region us-central1 \
  --allow-unauthenticated \
  --labels dev-tutorial=devnewyear2026
Enter fullscreen mode Exit fullscreen mode

What I'm Most Proud Of

I am most proud of the "Ambiguity Engine" architecture.

In the customs industry, "Black Box" AI is dangerous. A simple misclassification (e.g., mistaking a combat knife for a kitchen utensil) can lead to duty evasion and national security risks. Relying solely on probability scores is not enough.

I am proud that I successfully built a Hybrid Neuro-Symbolic System that solves this:

  1. It Detects Legal Conflicts: Instead of blindly trusting the AI's vision, my Python logic intercepts the result and cross-references it with a deterministic rule set (ambiguity_map.json).
  2. It Enforces Auditability: When a high-risk item is detected, the system forces a "Human-in-the-Loop" intervention. This creates a transparent decision trail that is legally defensible.

🚧 Lesson Learned & Future Roadmap

While this prototype successfully demonstrates the "Human-in-the-Loop" concept, a production-ready version would require:

  1. Dynamic Rule Database: Currently, the Ambiguity Engine uses a static JSON file for demonstration purposes. In a real-world deployment, this would connect to a live SQL database of National Customs Rulings.
  2. Confidence Thresholds: For the "Green Lane" (AI Autopilot), future versions will include a confidence score check. If Gemini is less than 90% sure, it should automatically route the item to the "Red Lane" for human review, reducing the risk of hallucinations.

This project proves that with the right combination of tools (Gemini for perception + Python for logic), we can build AI that is not only smart but also compliant, safe, and trustworthy to facilitate global trade.

Top comments (0)