Spaces:
Paused
Paused
Commit ·
b0aa891
1
Parent(s): d8bf59e
Update main.py
Browse files
main.py
CHANGED
|
@@ -42,11 +42,11 @@ async def demo():
|
|
| 42 |
<html>
|
| 43 |
<body>
|
| 44 |
<div id="content"></div>
|
| 45 |
-
|
| 46 |
<script>
|
| 47 |
var source = new EventSource("https://matthoffner-starchat-alpha.hf.space/stream");
|
| 48 |
source.onmessage = function(event) {
|
| 49 |
-
document.getElementById("content").innerHTML += event.data
|
| 50 |
};
|
| 51 |
</script>
|
| 52 |
|
|
@@ -56,7 +56,7 @@ async def demo():
|
|
| 56 |
return HTMLResponse(content=html_content, status_code=200)
|
| 57 |
|
| 58 |
@app.get("/stream")
|
| 59 |
-
async def chat(prompt = "Write a simple
|
| 60 |
tokens = llm.tokenize(prompt)
|
| 61 |
async def server_sent_events(chat_chunks, llm):
|
| 62 |
yield prompt
|
|
|
|
| 42 |
<html>
|
| 43 |
<body>
|
| 44 |
<div id="content"></div>
|
| 45 |
+
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
| 46 |
<script>
|
| 47 |
var source = new EventSource("https://matthoffner-starchat-alpha.hf.space/stream");
|
| 48 |
source.onmessage = function(event) {
|
| 49 |
+
document.getElementById("content").innerHTML += marked.parse(event.data)
|
| 50 |
};
|
| 51 |
</script>
|
| 52 |
|
|
|
|
| 56 |
return HTMLResponse(content=html_content, status_code=200)
|
| 57 |
|
| 58 |
@app.get("/stream")
|
| 59 |
+
async def chat(prompt = "Write a simple expres server"):
|
| 60 |
tokens = llm.tokenize(prompt)
|
| 61 |
async def server_sent_events(chat_chunks, llm):
|
| 62 |
yield prompt
|