Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,7 +56,6 @@ def make_prompt(entry):
|
|
| 56 |
@spaces.GPU
|
| 57 |
def generate(
|
| 58 |
message: str,
|
| 59 |
-
chat_history: list[tuple[str, str]],
|
| 60 |
max_new_tokens: int = 1024,
|
| 61 |
# temperature: float = 0.1,
|
| 62 |
# top_p: float = 0.9,
|
|
@@ -64,11 +63,6 @@ def generate(
|
|
| 64 |
# repetition_penalty: float = 1.0,
|
| 65 |
|
| 66 |
) -> Iterator[str]:
|
| 67 |
-
conversation = []
|
| 68 |
-
for user, assistant in chat_history:
|
| 69 |
-
conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
|
| 70 |
-
conversation.append({"role": "user", "content": make_prompt(message)})
|
| 71 |
-
|
| 72 |
enc = tokenizer(make_prompt(message), return_tensors="pt", padding=True, truncation=True)
|
| 73 |
|
| 74 |
|
|
@@ -122,5 +116,3 @@ if __name__ == "__main__":
|
|
| 122 |
demo.queue(max_size=20)
|
| 123 |
demo.launch(share=True)
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
|
|
|
| 56 |
@spaces.GPU
|
| 57 |
def generate(
|
| 58 |
message: str,
|
|
|
|
| 59 |
max_new_tokens: int = 1024,
|
| 60 |
# temperature: float = 0.1,
|
| 61 |
# top_p: float = 0.9,
|
|
|
|
| 63 |
# repetition_penalty: float = 1.0,
|
| 64 |
|
| 65 |
) -> Iterator[str]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
enc = tokenizer(make_prompt(message), return_tensors="pt", padding=True, truncation=True)
|
| 67 |
|
| 68 |
|
|
|
|
| 116 |
demo.queue(max_size=20)
|
| 117 |
demo.launch(share=True)
|
| 118 |
|
|
|
|
|
|