Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,9 @@ async def extract_code_blocks(markdown_text):
|
|
45 |
|
46 |
return code_blocks
|
47 |
|
48 |
-
async def generate_infographic(
|
|
|
|
|
49 |
generated_completion = client.chat.completions.create(
|
50 |
model="llama-3.1-70b-versatile",
|
51 |
messages=[
|
@@ -71,9 +73,7 @@ async def serve_frontend():
|
|
71 |
# Route to handle infographic generation
|
72 |
@app.post("/generate")
|
73 |
async def generate_infographic(request: InfographicRequest):
|
74 |
-
|
75 |
-
prompt = PROMPT_TEMPLATE.format(description=description)
|
76 |
-
code_blocks= await generate_infographic(prompt)
|
77 |
if code_blocks:
|
78 |
return JSONResponse(content={"html": code_blocks[0]})
|
79 |
else:
|
|
|
45 |
|
46 |
return code_blocks
|
47 |
|
48 |
+
async def generate_infographic(request: InfographicRequest):
|
49 |
+
description = request.description
|
50 |
+
prompt = PROMPT_TEMPLATE.format(description=description)
|
51 |
generated_completion = client.chat.completions.create(
|
52 |
model="llama-3.1-70b-versatile",
|
53 |
messages=[
|
|
|
73 |
# Route to handle infographic generation
|
74 |
@app.post("/generate")
|
75 |
async def generate_infographic(request: InfographicRequest):
|
76 |
+
code_blocks= await generate_infographic(request)
|
|
|
|
|
77 |
if code_blocks:
|
78 |
return JSONResponse(content={"html": code_blocks[0]})
|
79 |
else:
|