Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -22,21 +22,29 @@ templates = Jinja2Templates(directory="templates")
|
|
| 22 |
@app.get("/", response_class=HTMLResponse)
|
| 23 |
async def show_form(request: Request):
|
| 24 |
return templates.TemplateResponse("form.html", {"request": request})
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
async def refine_api(idea: str = Form(...)):
|
| 28 |
result = run_refiner(idea)
|
| 29 |
|
|
|
|
| 30 |
markdown_output = f"""
|
| 31 |
## 🧠 Refined Idea
|
| 32 |
{result['refined_idea']}
|
|
|
|
| 33 |
---
|
|
|
|
| 34 |
## 📊 Market Info
|
| 35 |
{result['market_info']}
|
|
|
|
| 36 |
---
|
|
|
|
| 37 |
## 📽️ Slide Summary
|
| 38 |
{result['slide_summary']}
|
| 39 |
"""
|
| 40 |
|
| 41 |
html_output = markdown(markdown_output)
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
@app.get("/", response_class=HTMLResponse)
|
| 23 |
async def show_form(request: Request):
|
| 24 |
return templates.TemplateResponse("form.html", {"request": request})
|
| 25 |
+
@app.post("/refine", response_class=HTMLResponse)
|
| 26 |
+
async def refine(request: Request, idea: str = Form(...)):
|
|
|
|
| 27 |
result = run_refiner(idea)
|
| 28 |
|
| 29 |
+
# Format all results into Markdown
|
| 30 |
markdown_output = f"""
|
| 31 |
## 🧠 Refined Idea
|
| 32 |
{result['refined_idea']}
|
| 33 |
+
|
| 34 |
---
|
| 35 |
+
|
| 36 |
## 📊 Market Info
|
| 37 |
{result['market_info']}
|
| 38 |
+
|
| 39 |
---
|
| 40 |
+
|
| 41 |
## 📽️ Slide Summary
|
| 42 |
{result['slide_summary']}
|
| 43 |
"""
|
| 44 |
|
| 45 |
html_output = markdown(markdown_output)
|
| 46 |
+
|
| 47 |
+
return templates.TemplateResponse("result.html", {
|
| 48 |
+
"request": request,
|
| 49 |
+
"output_html": html_output
|
| 50 |
+
})
|