<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mohamed Emam on Medium]]></title>
        <description><![CDATA[Stories by Mohamed Emam on Medium]]></description>
        <link>https://medium.com/@mohamedem2m?source=rss-ef007d4bb11e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OPXcGUtE-c1JltARBM4kZg.jpeg</url>
            <title>Stories by Mohamed Emam on Medium</title>
            <link>https://medium.com/@mohamedem2m?source=rss-ef007d4bb11e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 12:39:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohamedem2m/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[DynaPrompt: A Cleaner Way to Manage Prompts in LLM Apps]]></title>
            <link>https://medium.com/@mohamedem2m/dynaprompt-a-cleaner-way-to-manage-prompts-in-llm-apps-b5464beaf1aa?source=rss-ef007d4bb11e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5464beaf1aa</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[writing-prompts]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Mohamed Emam]]></dc:creator>
            <pubDate>Fri, 15 May 2026 20:06:01 GMT</pubDate>
            <atom:updated>2026-05-15T20:06:42.660Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5mygHm9zKUhaRy1NsN_JRw.png" /></figure><p><strong>LLM </strong>apps usually start with a few hardcoded prompts. Then the app grows, the logic spreads across files, and prompt handling turns into a mix of string templates, environment checks, and scattered config. <a href="https://github.com/mohamed-em2m/dynaprompt"><strong>DynaPrompt</strong> </a>was built to solve that problem by turning prompts into a structured, lazy-loading configuration layer for LLM applications. It separates templates from application logic and supports <strong>Jinja2 </strong>templates plus <strong>Pydantic </strong>schemas. (<a href="https://github.com/mohamed-em2m/dynaprompt">GitHub</a>)</p><h3>Why this matters</h3><p>If you have ever built an <strong>LLM </strong>workflow, you have probably seen prompts live inside Python strings, f-strings, or JSON blobs. That works for a prototype, but it gets messy fast when you need different environments, schema validation, reusable templates, or clean versioning. DynaPrompt positions itself as a more maintainable alternative by organizing prompts as configuration rather than code. (<a href="https://github.com/mohamed-em2m/dynaprompt">GitHub</a>)</p><h3>What DynaPrompt does</h3><p>At a high level, <strong>DynaPrompt </strong>lets you manage prompts in standalone files, load them lazily, and render them with variables at runtime. The README shows support for Markdown prompt files with YAML frontmatter, TOML-based environment layering, external file-based templates, auto-export into a central pyprompts.toml, validation hooks, and inspection tools for tracing how prompts were loaded and merged. (<a href="https://github.com/mohamed-em2m/dynaprompt">GitHub</a>)</p><h3>The clean mental model</h3><p>Instead of writing this:</p><pre>SYSTEM_PROMPT = f&quot;&quot;&quot;<br>You are a helpful assistant.<br>Current User: {user_name}<br>Format your output according to this schema:<br>{json.dumps(MySchema.model_json_schema())}<br>&quot;&quot;&quot;</pre><p><strong>DynaPrompt </strong>encourages a more modular flow: define your prompt in a prompt file, keep config separate, and render it when needed. The repo’s README shows examples where a prompt is loaded with DynaPrompt(settings_files=[&quot;prompts/&quot;]), then rendered with runtime variables like user_name and code_snippet. (<a href="https://github.com/mohamed-em2m/dynaprompt">GitHub</a>)</p><h3>Features that stand out</h3><p>One strong part of <a href="https://github.com/mohamed-em2m/dynaprompt"><strong>DynaPrompt</strong></a><strong> </strong>is environment layering. The README shows how you can define base settings and override them for production, so the same prompt can use different models or temperatures depending on context. It also supports auto-exporting prompts to TOML, which helps keep prompt assets organized as projects grow. (<a href="https://github.com/mohamed-em2m/dynaprompt">GitHub</a>)</p><p>Another useful piece is validation and hooks. The project includes an example validator that rejects prompts that exceed a token limit, plus a pre-render hook that injects the current date into every prompt before rendering. That makes prompt pipelines easier to control and safer to standardize. (<a href="https://github.com/mohamed-em2m/dynaprompt">GitHub</a>)</p><h3>Built for developer productivity</h3><p><strong>DynaPrompt </strong>also emphasizes inspection and tab-completion. The README says you can inspect where a prompt came from, how it was merged across layers, and browse available prompts in your IDE using dir(prompts) or Tab completion. That is a small detail, but it matters when prompt libraries become large and difficult to reason about. (<a href="https://github.com/mohamed-em2m/dynaprompt">GitHub</a>)</p><h3>Who this is for</h3><p>DynaPrompt looks especially useful for teams building:</p><ul><li>LLM apps with multiple environments</li><li>prompt-heavy products that need structure and reuse</li><li>applications that use schema-driven structured outputs</li><li>projects where prompt logic should stay separate from business logic (<a href="https://github.com/mohamed-em2m/dynaprompt">GitHub</a>)</li></ul><h3>Final thoughts</h3><p><a href="https://github.com/mohamed-em2m/dynaprompt"><strong>DynaPrompt</strong> </a>is not trying to be a generic <strong>LLM </strong>framework. It is narrower than that, and that is part of the appeal. It focuses on one painful part of LLM development — prompt management — and gives it structure, layering, validation, and clean rendering. For teams that are tired of prompt spaghetti, that is a genuinely practical idea. (<a href="https://github.com/mohamed-em2m/dynaprompt">GitHub</a>)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5464beaf1aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Turn Google Colab and Kaggle into a Live Server]]></title>
            <link>https://medium.com/@mohamedem2m/how-to-turn-google-colab-and-kaggle-into-a-live-server-89a62f14deb9?source=rss-ef007d4bb11e------2</link>
            <guid isPermaLink="false">https://medium.com/p/89a62f14deb9</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[kaggle]]></category>
            <dc:creator><![CDATA[Mohamed Emam]]></dc:creator>
            <pubDate>Fri, 26 Dec 2025 15:19:57 GMT</pubDate>
            <atom:updated>2025-12-26T15:19:57.381Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lUFyHYSVR7XIAfpI4UjBxw.png" /></figure><p>Deploy Deep Learning models for free using Ngrok and Cloudflare Tunnels<strong> </strong>If you’re working on a <strong>graduation project</strong>, a <strong>deep learning prototype</strong>, or even a quick <strong>AI demo</strong>, you’ll quickly hit a frustrating wall:</p><blockquote><em>❌ </em>“My model works… but where do I host it?”</blockquote><p>Running Machine Learning and Deep Learning models often requires a <strong>GPU</strong>, and cloud servers are expensive.<br>Meanwhile, <strong>Google Colab</strong> and <strong>Kaggle</strong> give you <strong>free GPUs</strong> — but only for notebooks, not real servers.</p><p>No public IP.<br>No incoming HTTP requests.<br>No real deployment.</p><p>But there’s a workaround 👇</p><h3>The Idea: Using Tunnels</h3><p>Colab and Kaggle notebooks run on virtual machines hidden behind Google’s infrastructure. That means your localhost is invisible to the internet.</p><p>A <strong>tunneling service</strong> solves this by:</p><ol><li>Creating a secure connection from your notebook</li><li>Exposing it through a <strong>public URL</strong></li><li>Forwarding incoming requests to your local FastAPI or Flask app</li></ol><p>With tunnels, your notebook can behave like a real backend server.</p><p>In this article, you’ll learn <strong>two approaches</strong>:</p><ul><li><strong>Ngrok</strong> → fast and simple</li><li><strong>Cloudflare Tunnel</strong> → stable and professional and faster</li></ul><h3>Method 1: Ngrok (Quick &amp; Simple)</h3><p><strong>Best for:</strong></p><ul><li>Fast demos</li><li>Testing APIs</li><li>Learning FastAPI or Flask</li></ul><p><strong>Pros</strong></p><ul><li>Very easy setup</li><li>Works on <strong>Colab and Kaggle</strong></li><li>Free</li></ul><p><strong>Cons</strong></p><ul><li>The public URL <strong>changes every restart</strong></li></ul><p>Ngrok is perfect when you just want to see your API working online without complex setup.</p><h3>Example: FastAPI + Ngrok</h3><p>First, install the required packages:</p><pre>!pip install ngrok pyngrok fastapi uvicorn</pre><p>Then run the following code:</p><pre>from pyngrok import ngrok<br>from fastapi import FastAPI<br>import uvicorn</pre><pre># Replace with your ngrok auth token<br>NGROK_AUTH_TOKEN = &quot;YOUR_NGROK_AUTH_TOKEN&quot;<br>ngrok.set_auth_token(NGROK_AUTH_TOKEN)</pre><pre>app = FastAPI()</pre><pre>@app.get(&quot;/&quot;)<br>def root():<br>    return {&quot;message&quot;: &quot;Hello from FastAPI with ngrok!&quot;}</pre><pre>@app.get(&quot;/items/{item_id}&quot;)<br>def read_item(item_id: int, q: str = None):<br>    return {&quot;item_id&quot;: item_id, &quot;q&quot;: q}</pre><pre>if __name__ == &quot;__main__&quot;:<br>    port = 8000<br>    public_url = ngrok.connect(port)<br>    print(&quot;Public URL:&quot;, public_url)</pre><pre>    uvicorn.run(app, host=&quot;0.0.0.0&quot;, port=port)</pre><p>Once it runs, Ngrok will print a <strong>public URL</strong> — open it in your browser and your API is live 🚀</p><h3>Method 2: Cloudflare Tunnel (Professional &amp; Stable)</h3><p><strong>Best for:</strong></p><ul><li>Graduation projects</li><li>Final demos</li><li>Mobile or frontend backends</li></ul><p><strong>Pros</strong></p><ul><li><strong>Static URL</strong> (e.g. api.yourproject.com)</li><li>Looks professional</li><li>Very stable connection</li></ul><p><strong>Cons</strong></p><ul><li>Requires a domain name</li><li>Credit card required for Cloudflare Zero Trust activation (free tier)</li></ul><p>If you’re submitting a project to a university or client, this is the <strong>recommended approach</strong>.</p><h3>What You Need Before Starting</h3><ol><li><strong>A domain name</strong><br>(Namecheap, Google Domains, or free options like Freenom)</li><li><strong>A Cloudflare account</strong><br>Add your domain and enable <strong>Zero Trust</strong></li><li><strong>Tunnel token</strong><br>Generated from the Cloudflare dashboard</li></ol><h3>Why Cloudflare Is Tricky on Colab</h3><p>Installing cloudflared usually requires:</p><ul><li>sudo access</li><li>Interactive shell commands</li><li>System services</li></ul><p>Colab doesn’t play nicely with that — so we automate everything using <strong>pexpect</strong>.</p><h3>Cloudflare Tunnel Setup (Colab-Compatible)</h3><blockquote><em>⚠️ Replace </em><em>&quot;your_token&quot; with the token from Cloudflare Zero Trust.</em></blockquote><pre>!pip install pexpect<br>import pexpect</pre><pre>def run(term, cmd, timeout=30):<br>    print(f&quot;Running: {cmd}&quot;)<br>    term.sendline(cmd)<br>    term.expect_exact(&quot;#&quot;, timeout=timeout)<br>    print(term.before)</pre><pre># Open root shell<br>term = pexpect.spawn(&quot;sudo -s&quot;, encoding=&quot;utf-8&quot;, timeout=30)<br>term.expect_exact(&quot;#&quot;)</pre><pre># Add Cloudflare repo<br>run(term, &quot;mkdir -p --mode=0755 /usr/share/keyrings&quot;)<br>run(term, &quot;curl -fsSL <a href="https://pkg.cloudflare.com/cloudflare-public-v2.gpg">https://pkg.cloudflare.com/cloudflare-public-v2.gpg</a> | tee /usr/share/keyrings/cloudflare-public-v2.gpg &gt;/dev/null&quot;)<br>run(term, &quot;echo &#39;deb [signed-by=/usr/share/keyrings/cloudflare-public-v2.gpg] <a href="https://pkg.cloudflare.com/cloudflared">https://pkg.cloudflare.com/cloudflared</a> any main&#39; | tee /etc/apt/sources.list.d/cloudflared.list&quot;)</pre><pre># Install cloudflared<br>run(term, &quot;apt-get update -y&quot;, timeout=60)<br>run(term, &quot;apt-get install -y cloudflared&quot;, timeout=60)</pre><pre># Install tunnel as a service<br>token = &quot;your_token&quot;<br>run(term, f&quot;cloudflared service install {token}&quot;)</pre><pre># Start and enable service<br>run(term, &quot;systemctl start cloudflared&quot;)<br>run(term, &quot;systemctl enable cloudflared&quot;)</pre><pre># Check status<br>run(term, &quot;systemctl status cloudflared --no-pager&quot;)</pre><pre>term.sendline(&quot;exit&quot;)<br>term.wait()</pre><pre>print(&quot;✅ Cloudflare Tunnel is running in the background&quot;)</pre><p>Once this finishes, your notebook is permanently connected to your domain.</p><p>Run your FastAPI or Flask app on the configured port, and it will be accessible <strong>globally</strong> 🌍</p><h3>Which One Should You Use?</h3><p>I prefer cloudflare it’s faster and give static domain to work on .</p><h3>Helpful Video Tutorials</h3><p>If you prefer visual walkthroughs:</p><ul><li>Cloudflare Tunnel setup<br><a href="https://www.youtube.com/watch?v=ey4u7OUAF3c">https://www.youtube.com/watch?v=ey4u7OUAF3c</a></li><li>Advanced tunnel configuration<br><a href="https://www.youtube.com/watch?v=wyKkeb3w5lI">https://www.youtube.com/watch?v=wyKkeb3w5lI</a></li></ul><p>#GoogleColab #Kaggle #FastAPI #CloudflareTunnel #Ngrok #DeepLearning #GraduationProject #Python #AI</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89a62f14deb9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>