Spaces:
Sleeping
Sleeping
william4416
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -17,14 +17,6 @@ def predict(input, history=[]):
|
|
17 |
new_user_input_ids = tokenizer.encode(
|
18 |
input + tokenizer.eos_token, return_tensors="pt"
|
19 |
)
|
20 |
-
|
21 |
-
if input_text.startswith("file"):
|
22 |
-
file_number = int(input_text[len("file"):])
|
23 |
-
file_name = f"file{file_number}.json"
|
24 |
-
json_data = read_json_file(file_name)
|
25 |
-
prompts = json_data.get("prompts", [])
|
26 |
-
random_prompt = random.choice(prompts)
|
27 |
-
return random_prompt["completion"]
|
28 |
|
29 |
# append the new user input tokens to the chat history
|
30 |
bot_input_ids = torch.cat([torch.LongTensor(history), new_user_input_ids], dim=-1)
|
|
|
17 |
new_user_input_ids = tokenizer.encode(
|
18 |
input + tokenizer.eos_token, return_tensors="pt"
|
19 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
# append the new user input tokens to the chat history
|
22 |
bot_input_ids = torch.cat([torch.LongTensor(history), new_user_input_ids], dim=-1)
|