Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ class InfographicRequest(BaseModel):
|
|
23 |
PROMPT_TEMPLATE = os.getenv("PROMPT_TEMPLATE")
|
24 |
|
25 |
|
26 |
-
def extract_code_blocks(markdown_text):
|
27 |
"""
|
28 |
Extracts code blocks from the given Markdown text.
|
29 |
|
@@ -67,8 +67,9 @@ async def generate_infographic(request: InfographicRequest):
|
|
67 |
generated_text = ""
|
68 |
for chunk in stream:
|
69 |
generated_text += chunk.choices[0].delta.content
|
70 |
-
|
71 |
-
|
|
|
72 |
if code_blocks:
|
73 |
return JSONResponse(content={"html": code_blocks[0]})
|
74 |
else:
|
|
|
23 |
PROMPT_TEMPLATE = os.getenv("PROMPT_TEMPLATE")
|
24 |
|
25 |
|
26 |
+
async def extract_code_blocks(markdown_text):
|
27 |
"""
|
28 |
Extracts code blocks from the given Markdown text.
|
29 |
|
|
|
67 |
generated_text = ""
|
68 |
for chunk in stream:
|
69 |
generated_text += chunk.choices[0].delta.content
|
70 |
+
|
71 |
+
print(generated_text)
|
72 |
+
code_blocks= await extract_code_blocks(generated_text)
|
73 |
if code_blocks:
|
74 |
return JSONResponse(content={"html": code_blocks[0]})
|
75 |
else:
|