|
| 1 | +--- |
| 2 | +title: "DMP ’25 Week 02 Update by Harshit Verma" |
| 3 | +excerpt: "To develop a basic FastAPI server and integrate it with Pippy." |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-06-15" |
| 6 | +slug: "2025-06-15-dmp-25-therealharshit-week02" |
| 7 | +author: "@/constants/MarkdownFiles/authors/harshit-verma.md" |
| 8 | +tags: "dmp25,sugarlabs,week02,therealharshit" |
| 9 | +image: "assets/Images/c4gt_DMP.png" |
| 10 | +--- |
| 11 | + |
| 12 | +<!-- markdownlint-disable --> |
| 13 | + |
| 14 | +# Week 02 Progress Report by Harshit Verma |
| 15 | + |
| 16 | +**Project:** [LLM-powered Debugger for Pippy](https://github.com/sugarlabs/Pippy/issues/95) |
| 17 | +**Mentors:** [Walter Bender](https://github.com/walterbender), [Ibiam Chihurumnaya](https://github.com/chimosky), [Kshitij Shah](https://github.com/kshitijdshah99) |
| 18 | +**Assisting Mentors:** [Devin Ulibarri](https://github.com/pikurasa) |
| 19 | +**Reporting Period:** 2025-06-09 - 2025-06-15 |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Goals for This Week |
| 24 | + |
| 25 | +- **Goal 1:** Set up a basic FastAPI server. |
| 26 | +- **Goal 2:** Integrate a Hugging Face model. |
| 27 | +- **Goal 3:** Add 'Run and Debug' buttons to Pippy UI. |
| 28 | +- **Goal 4:** Connect Pippy to the FastAPI Server. |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## This Week’s Achievements |
| 33 | + |
| 34 | +1. **Built FastAPI Server with `/debug` Endpoint** |
| 35 | + - Created a simple FastAPI app that listens for POST requests at `/debug`. |
| 36 | + - The endpoint accepts raw Python code, forwards it to the model, and returns debug tips. |
| 37 | + |
| 38 | +2. **Integrated Hugging Face Model** |
| 39 | + - Loaded a lightweight model (Qwen/Qwen2.5-1.5B-Instruct) from Hugging Face using `transformers`. |
| 40 | + - Connected the model with the `/debug` endpoint to generate relevant debugging suggestions. |
| 41 | + |
| 42 | +3. **Updated Pippy UI with Debugging Controls** |
| 43 | + - Added 'Run and Debug' buttons to the Pippy interface. |
| 44 | +  |
| 45 | + - This was designed to trigger actions like execute code and get debugging feedback. |
| 46 | + |
| 47 | +4. **Connected Pippy to the FastAPI Server** |
| 48 | + - Implemented functionality to extract code from the Pippy editor. |
| 49 | + ```Python |
| 50 | + #To extract the source code |
| 51 | + |
| 52 | + def _get_current_code(self): |
| 53 | + pippy_tmp_dir = '%s/tmp/' % self.get_activity_root() |
| 54 | + current_file = os.path.join( |
| 55 | + pippy_tmp_dir, |
| 56 | + self._source_tabs.get_current_file_name() |
| 57 | + ) |
| 58 | + |
| 59 | + try: |
| 60 | + with open(current_file, 'r') as f: |
| 61 | + return f.read() |
| 62 | + except Exception as e: |
| 63 | + print(f"Error reading file {current_file}: {e}") |
| 64 | + return None |
| 65 | + ``` |
| 66 | + - Successfully set up an API call from Pippy to the FastAPI server when the 'Run and Debug' button is clicked. |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +## Challenges & How I Overcame Them |
| 71 | + |
| 72 | +- **Challenge:** Running the model locally on CPU. |
| 73 | + **Solution:** Faced performance limitations due to lack of GPU support. I resolved this by selecting a small, efficient model from Hugging Face. |
| 74 | + |
| 75 | +- **Challenge:** Using GTK for Pippy UI integration. |
| 76 | + **Solution:** Since GTK was new to me, adding buttons and handling events required exploring GTK documentation and existing Sugar activity patterns. With guidance and trial-and-error, I successfully added and wired up the 'Run and Debug' button to Pippy’s interface. |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +## Key Learnings |
| 81 | + |
| 82 | +- Learned how to build and structure an API with FastAPI. |
| 83 | +- Gained experience integrating Hugging Face models programmatically. |
| 84 | +- Understood how to bridge frontend (Pippy) with backend (FastAPI) effectively. |
| 85 | +- Improved at working across virtual machines, ports, and networking setups. |
| 86 | + |
| 87 | +--- |
| 88 | + |
| 89 | +## Next Week’s Roadmap |
| 90 | + |
| 91 | +- Improve prompt engineering for better debugging tips. |
| 92 | +- Add visual display of debug tips in the Pippy interface. |
| 93 | +- Integrate sugar-ai with Pippy. |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## Acknowledgments |
| 98 | + |
| 99 | +Thank you to my mentors, the Sugar Labs community, and fellow contributors for your continued guidance and support! |
| 100 | + |
| 101 | +--- |
0 commit comments