Upload app1.py
Browse files
app1.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""
|
3 |
+
Created on Sat Oct 5 16:41:22 2024
|
4 |
+
|
5 |
+
@author: Admin
|
6 |
+
"""
|
7 |
+
|
8 |
+
import gradio as gr
|
9 |
+
from transformers import pipeline
|
10 |
+
|
11 |
+
|
12 |
+
#chatbot = pipeline(model="NCSOFT/Llama-3-OffsetBias-8B")
|
13 |
+
chatbot = pipeline(model="meta-llama/Llama-3.2-1B-Instruct",device="cuda")
|
14 |
+
|
15 |
+
message_list = []
|
16 |
+
response_list = []
|
17 |
+
|
18 |
+
|
19 |
+
def vanilla_chatbot(message, history):
|
20 |
+
conversation = chatbot(message)
|
21 |
+
|
22 |
+
return conversation[0]['generated_text']
|
23 |
+
|
24 |
+
demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Vanilla Chatbot", description="Enter text to start chatting.")
|
25 |
+
|
26 |
+
demo_chatbot.launch()
|