Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,14 @@
|
|
1 |
-
import
|
2 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
import gradio as gr
|
4 |
|
5 |
-
# Load model
|
6 |
-
|
7 |
-
|
8 |
-
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME)
|
9 |
|
10 |
# Define chatbot function
|
11 |
def chatbot(input_text):
|
12 |
-
|
13 |
-
|
14 |
-
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
15 |
-
return response
|
16 |
|
17 |
# Create Gradio interface
|
18 |
interface = gr.Interface(fn=chatbot, inputs="text", outputs="text", title="Vinamallama 7B Chatbot")
|
|
|
1 |
+
from llama_cpp import Llama
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
+
# Load model
|
5 |
+
MODEL_PATH = "./model/vinallama-2.7b-chat.gguf" # 膼瓢峄漬g d岷玭 膽岷縩 m么 h矛nh GGUF
|
6 |
+
model = Llama(model_path=MODEL_PATH)
|
|
|
7 |
|
8 |
# Define chatbot function
|
9 |
def chatbot(input_text):
|
10 |
+
response = model(input_text, max_tokens=200, temperature=0.7)
|
11 |
+
return response['choices'][0]['text']
|
|
|
|
|
12 |
|
13 |
# Create Gradio interface
|
14 |
interface = gr.Interface(fn=chatbot, inputs="text", outputs="text", title="Vinamallama 7B Chatbot")
|