Spaces:
Sleeping
Sleeping
gokul00060
commited on
Commit
•
fe7c25c
1
Parent(s):
c395d21
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
+
from transformers import pipeline
|
3 |
+
from streamlit import title, input_text, button, text
|
4 |
+
|
5 |
+
# Define model and tokenizer
|
6 |
+
model_name = "gokul00060/loora-chat-arm"
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
8 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
9 |
+
|
10 |
+
# Create pipeline for inference
|
11 |
+
chat_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
12 |
+
|
13 |
+
# Streamlit app
|
14 |
+
title("Chat with Lora Adaptor")
|
15 |
+
|
16 |
+
text_input = input_text("Enter your message:")
|
17 |
+
|
18 |
+
if button("Send"):
|
19 |
+
# Generate response
|
20 |
+
response = chat_pipeline(text_input, max_length=1024)
|
21 |
+
text(f"Lora: {response[0]['text']}")
|
22 |
+
|