Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
6 |
tokenizer = AutoTokenizer.from_pretrained("ping98k/typhoon-7b-rag-instruct-th")
|
7 |
model = AutoModelForCausalLM.from_pretrained("ping98k/typhoon-7b-rag-instruct-th", device_map={"": 0})
|
8 |
|
9 |
-
|
10 |
'''def response(instruction, history, inputText):
|
11 |
inp = f"""### Instruction:
|
12 |
{instruction}
|
@@ -40,6 +40,7 @@ gr.ChatInterface(
|
|
40 |
],
|
41 |
).launch()'''
|
42 |
|
|
|
43 |
def response(inp):
|
44 |
input_ids = tokenizer(inp, return_tensors='pt').to("cuda")
|
45 |
beam_output = model.generate(**input_ids, max_new_tokens=300)
|
|
|
6 |
tokenizer = AutoTokenizer.from_pretrained("ping98k/typhoon-7b-rag-instruct-th")
|
7 |
model = AutoModelForCausalLM.from_pretrained("ping98k/typhoon-7b-rag-instruct-th", device_map={"": 0})
|
8 |
|
9 |
+
|
10 |
'''def response(instruction, history, inputText):
|
11 |
inp = f"""### Instruction:
|
12 |
{instruction}
|
|
|
40 |
],
|
41 |
).launch()'''
|
42 |
|
43 |
+
@spaces.GPU(duration=120)
|
44 |
def response(inp):
|
45 |
input_ids = tokenizer(inp, return_tensors='pt').to("cuda")
|
46 |
beam_output = model.generate(**input_ids, max_new_tokens=300)
|