Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 32 |
model.eval()
|
| 33 |
|
| 34 |
|
| 35 |
-
@spaces.GPU(duration=
|
| 36 |
def generate(
|
| 37 |
message: str,
|
| 38 |
chat_history: list[tuple[str, str]],
|
|
@@ -42,11 +42,12 @@ def generate(
|
|
| 42 |
top_k: int = 50,
|
| 43 |
repetition_penalty: float = 1.2,
|
| 44 |
) -> Iterator[str]:
|
| 45 |
-
conversation = [json.loads(os.getenv("PROMPT"))]
|
|
|
|
| 46 |
for user, assistant in chat_history:
|
| 47 |
conversation.extend(
|
| 48 |
[
|
| 49 |
-
json.loads(os.getenv("PROMPT")),
|
| 50 |
{"role": "user", "content": user},
|
| 51 |
{"role": "assistant", "content": assistant},
|
| 52 |
]
|
|
|
|
| 32 |
model.eval()
|
| 33 |
|
| 34 |
|
| 35 |
+
@spaces.GPU(duration=180)
|
| 36 |
def generate(
|
| 37 |
message: str,
|
| 38 |
chat_history: list[tuple[str, str]],
|
|
|
|
| 42 |
top_k: int = 50,
|
| 43 |
repetition_penalty: float = 1.2,
|
| 44 |
) -> Iterator[str]:
|
| 45 |
+
# conversation = [json.loads(os.getenv("PROMPT"))]
|
| 46 |
+
conversation = []
|
| 47 |
for user, assistant in chat_history:
|
| 48 |
conversation.extend(
|
| 49 |
[
|
| 50 |
+
# json.loads(os.getenv("PROMPT")),
|
| 51 |
{"role": "user", "content": user},
|
| 52 |
{"role": "assistant", "content": assistant},
|
| 53 |
]
|