Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import signal
|
|
4 |
import warnings
|
5 |
import shutil
|
6 |
import logging
|
|
|
7 |
import json
|
8 |
import time
|
9 |
from datetime import datetime
|
@@ -19,6 +20,20 @@ import atexit
|
|
19 |
warnings.filterwarnings('ignore', category=UserWarning)
|
20 |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
def initialize_environment():
|
23 |
"""Initialize application environment and configurations"""
|
24 |
# Create necessary directories
|
|
|
4 |
import warnings
|
5 |
import shutil
|
6 |
import logging
|
7 |
+
import spaces
|
8 |
import json
|
9 |
import time
|
10 |
from datetime import datetime
|
|
|
20 |
warnings.filterwarnings('ignore', category=UserWarning)
|
21 |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
22 |
|
23 |
+
@spaces.GPU()
|
24 |
+
def stream_chat(
|
25 |
+
message: str,
|
26 |
+
history: list,
|
27 |
+
system_prompt: str,
|
28 |
+
temperature: float = 0.8,
|
29 |
+
max_new_tokens: int = 1024,
|
30 |
+
top_p: float = 1.0,
|
31 |
+
top_k: int = 20,
|
32 |
+
penalty: float = 1.2,
|
33 |
+
):
|
34 |
+
print(f'message: {message}')
|
35 |
+
print(f'history: {history}')
|
36 |
+
|
37 |
def initialize_environment():
|
38 |
"""Initialize application environment and configurations"""
|
39 |
# Create necessary directories
|