Spaces:
Runtime error
Runtime error
Fix html output
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ from openai import OpenAI
|
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
import json
|
|
|
|
| 5 |
|
| 6 |
api_key = os.environ.get('FEATHERLESS_API_KEY')
|
| 7 |
client = OpenAI(
|
|
@@ -33,7 +34,9 @@ def respond(message, history, model):
|
|
| 33 |
partial_message = ""
|
| 34 |
for chunk in response:
|
| 35 |
if chunk.choices[0].delta.content is not None:
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
yield partial_message
|
| 38 |
|
| 39 |
logo = open('./logo.svg').read()
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
import json
|
| 5 |
+
import html
|
| 6 |
|
| 7 |
api_key = os.environ.get('FEATHERLESS_API_KEY')
|
| 8 |
client = OpenAI(
|
|
|
|
| 34 |
partial_message = ""
|
| 35 |
for chunk in response:
|
| 36 |
if chunk.choices[0].delta.content is not None:
|
| 37 |
+
content = chunk.choices[0].delta.content
|
| 38 |
+
escaped_content = html.escape(content)
|
| 39 |
+
partial_message += escaped_content
|
| 40 |
yield partial_message
|
| 41 |
|
| 42 |
logo = open('./logo.svg').read()
|