Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,10 +25,23 @@ def chat(user_input, max_tokens=11264):
|
|
| 25 |
max_tokens=max_tokens,
|
| 26 |
temperature=0.01,
|
| 27 |
top_p=1,
|
|
|
|
| 28 |
)
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
|
| 34 |
|
|
@@ -92,4 +105,4 @@ demo.launch()
|
|
| 92 |
#)
|
| 93 |
|
| 94 |
# launch Gradion Service
|
| 95 |
-
#interface.launch()
|
|
|
|
| 25 |
max_tokens=max_tokens,
|
| 26 |
temperature=0.01,
|
| 27 |
top_p=1,
|
| 28 |
+
stream=True,
|
| 29 |
)
|
| 30 |
+
|
| 31 |
+
def generate():
|
| 32 |
+
pass
|
| 33 |
+
|
| 34 |
+
resp_text = ""
|
| 35 |
+
thread = Thread(target=generate)
|
| 36 |
+
thread.start()
|
| 37 |
+
|
| 38 |
+
for chunk in response:
|
| 39 |
+
if chunk.choices[0].delta.content is not None:
|
| 40 |
+
resp_text += chunk.choices[0].delta.content
|
| 41 |
+
yield resp_text
|
| 42 |
+
print(resp_text)
|
| 43 |
+
|
| 44 |
+
thread.join()
|
| 45 |
|
| 46 |
|
| 47 |
|
|
|
|
| 105 |
#)
|
| 106 |
|
| 107 |
# launch Gradion Service
|
| 108 |
+
#interface.launch()
|