Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ model = PeftModel.from_pretrained(model, model_id)
|
|
25 |
def greet(text):
|
26 |
with torch.no_grad():
|
27 |
# Include EOS token for better context
|
28 |
-
input_text = "<s>### User:\n{text}\n\n### Assistant:\n"
|
29 |
|
30 |
batch = tokenizer(input_text, return_tensors='pt', add_special_tokens=True).to(device)
|
31 |
|
@@ -44,5 +44,6 @@ def greet(text):
|
|
44 |
response_parts = response.split("### Assistant:")
|
45 |
return response_parts[0] # Return only the first part
|
46 |
|
47 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text"
|
|
|
48 |
iface.launch() # Share directly to Gradio Space
|
|
|
25 |
def greet(text):
|
26 |
with torch.no_grad():
|
27 |
# Include EOS token for better context
|
28 |
+
input_text = f"<s>### User:\n{text}\n\n### Assistant:\n"
|
29 |
|
30 |
batch = tokenizer(input_text, return_tensors='pt', add_special_tokens=True).to(device)
|
31 |
|
|
|
44 |
response_parts = response.split("### Assistant:")
|
45 |
return response_parts[0] # Return only the first part
|
46 |
|
47 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text"
|
48 |
+
, title="PEFT Model for Big Brain")
|
49 |
iface.launch() # Share directly to Gradio Space
|