manabb commited on
Commit
caee6b1
·
verified ·
1 Parent(s): 6eda2cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -96,14 +96,21 @@ def generate_response(manual, proposal):
96
  return response.choices[0].message.content
97
 
98
  def generate_html(llm_response):
99
- lines = llm_response.strip().split('\n')
100
- html="<tr><td>"
 
 
101
  for line in lines:
102
- line = line.strip()
103
- html+="<br>"+line+"</br>"
104
- html="</td></tr>"
 
 
 
 
 
105
  return html
106
-
107
  #================================================Gradio==================
108
 
109
  def update_log(newRecords):
 
96
  return response.choices[0].message.content
97
 
98
  def generate_html(llm_response):
99
+ """Convert LLM response to HTML table row with line breaks."""
100
+ lines = llm_response.strip().split('\n') # Fixed: \n not \\n
101
+ html_lines = []
102
+
103
  for line in lines:
104
+ line = line.strip()
105
+ if line: # Skip empty lines
106
+ html_lines.append(line)
107
+
108
+ # Build proper <tr><td> with <br> for lines
109
+ content = '<br>'.join(html_lines) # Single <br> between lines
110
+ html = f"<tr><td>{content}</td></tr>"
111
+
112
  return html
113
+
114
  #================================================Gradio==================
115
 
116
  def update_log(newRecords):